[PATCH] Support of UCS2 for SMS/USSD

Pavel Baturko pabftk at gmail.com
Fri Feb 8 09:55:52 UTC 2013

Hi Harald,

>    Is there no way to get the information
>    programmatically, e.g.  by using localeconv(3) ?
Another way to get this information that I know is smthng like that:
+		old_locale = setlocale(LC_ALL, NULL);
+		curr_locale = setlocale(LC_ALL, "");
+		for (i = 0; i < strlen(curr_locale); i++)
+			curr_locale[i] = tolower(curr_locale[i]);
+		have_utf8_locale = ((strstr(curr_locale, "utf-8") != NULL) ||
+							(strstr(curr_locale, "utf8" ) != NULL)) ? 1 : 0;
+		setlocale(LC_ALL, old_locale);
Not sure if it's ok because of temporary changing of current locale.
unfortunately I was not able to find better ways to check locale.

> 2) the function "ucs2_to_utf8_decode" is cluttering the global namespace
>    even further.   Yes, it is in principle not a function related to
>    gsm, but I'd still appreciate if it would start with osmo_ or gsm_
>    prefix in order to make sure we don't clash with applications or
>    other libraries using the same symbol name.
I can move it to utils.c, is it acceptable? And of course add "osmo_" prefix.


More information about the baseband-devel mailing list