[PATCH] Decoding UCS2 USSD
Pavel Baturko
pabftk at gmail.com
Sat Sep 29 13:06:45 CEST 2012
Hi All,
I fixed issues. Some comments:
> Are these files always guaranteed to be available, or are some
configure.ac checks required in this change?
I'm not sure that checking is required because 'locale.h' is in standard C
library. Please correct me if I mistaken.
> Did you investigate if this function will handle UTF-8 data correctly? I
sure don't know that.
UTF-8 text is now not going from gsm480_rx_ussd function since terminal
with telnet which is connected to mobile app can not support UTF-8 and
there is no way to check it.
> I hope a better name than DSC_0f can be found
Author of gsm480_ss.c unfortunately does not remember why 0x0f constant is
used but if it's works and text is decoded as GSM 7bit - I changed name to
default3, hope it's ok.
And now I have 3 variants of patch:
ussd-ucs2.setlocale.patch - with setlocale function. locale is set to
"Environment's default locale" with setlocale(LC_ALL, "") and then restored
to previous. Calling of setlocale(LC_ALL, NULL) returns "C" (Minimal "C"
locale) and this is not what I want, so I have to manually set locale to
Env default and check if it's UTF-8. As I understand this variant is not
desirable.
ussd-ucs2.pipe.patch - locale is obtained from system shell with 'locale'
command. I can't think another method to check locale except calling
'locale' or function 'setlocale'. If someone knows - please let me know.
ussd-ucs2.hex.patch - compromise variant (no external programs calls, no
functions that affects whole app). Just convert text from UCS2 to UTF-8 and
print hex representation of the string.
Thanks,
Pavel
On Sat, Sep 22, 2012 at 1:57 PM, Holger Hans Peter Freyther <
holger at freyther.de> wrote:
> On Wed, Sep 19, 2012 at 09:49:29PM +0000, Pavel Baturko wrote:
> > Thanks for advises! New version: if received text in UCS2, convert it to
> > UTF-8, then check if console supports UTF-8, if yes - print message in
> vty
> > as usual, if not - print message in hex.
>
> Hi Pavel,
>
> thanks for updating the patch. Could you remove the calls to setlocale and
> move the actual ucs->utf8 folding into a new subroutine.
>
> thanks
>
> holger
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/baseband-devel/attachments/20120929/d1d8fb16/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ussd-ucs2.setlocale.patch
Type: application/octet-stream
Size: 9779 bytes
Desc: not available
URL: <http://lists.osmocom.org/pipermail/baseband-devel/attachments/20120929/d1d8fb16/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ussd-ucs2.pipe.patch
Type: application/octet-stream
Size: 9703 bytes
Desc: not available
URL: <http://lists.osmocom.org/pipermail/baseband-devel/attachments/20120929/d1d8fb16/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ussd-ucs2.hex.patch
Type: application/octet-stream
Size: 8995 bytes
Desc: not available
URL: <http://lists.osmocom.org/pipermail/baseband-devel/attachments/20120929/d1d8fb16/attachment-0005.obj>
More information about the baseband-devel
mailing list