aboutsummaryrefslogtreecommitdiff
path: root/src/mm-charsets.h
AgeCommit message (Collapse)Author
2022-09-13charsets: move mm_sms_part_3gpp_util_split_text to mm_charset_util_split_textAndrey Skvortsov
2021-02-23charsets: detect iconv() support in runtimeAleksander Morgado
The only purpose of this is to log what we found, nothing else, as a quick way to detect platform support for the charsets we need.
2021-02-23charsets: remove charset_hex_to_utf8()Aleksander Morgado
No longer used, replaced by the new common conversion methods.
2021-02-23charsets: remove take_and_convert methodsAleksander Morgado
These methods worked in a very strict way for some encodings, and in a very very loose way for others. E.g. when converting from hex-encoded UCS-2, we would attempt to convert as much text as we could even if the input string was truly not even close to UCS-2. This kind of "do our best" could make sense when processing e.g. the operator name reported by the modem, as that is some string to show to the user and there may be no strict requirement to have it perfectly fine. But the kind of loose comparison done for UCS-2 doesn't make sense e.g. when converting USSD responses or SMS messages.
2021-02-23charsets: use new bytearray_to_utf8() instead of byte_array_to_utf8()Aleksander Morgado
2021-02-23charsets: make charset_gsm_unpacked_to_utf8() privateAleksander Morgado
Use the generic mm_modem_charset_bytearray_to_utf8() instead.
2021-02-23charsets: use new bytearray_from_utf8() instead of byte_array_append()Aleksander Morgado
2021-02-23charsets: make charset_utf8_to_unpacked_gsm() privateAleksander Morgado
Use the generic mm_modem_charset_bytearray_from_utf8() instead.
2021-02-23charsets: new common APIs to convert from/to charsets and UTF-8Aleksander Morgado
2021-02-23charsets: make translit optional in utf8_to_unpacked_gsm()Aleksander Morgado
If the conversion is not fully compatible, the user of the method needs to request transliteration enabled explicitly in order to avoid returning errors in this method.
2021-02-23charsets: make translit optional in gsm_unpacked_to_utf8()Aleksander Morgado
Until now, this method would automatically apply transliteration; i.e. replacing characters with '?' when no direct translation was available. We can attempt to do that transliteration on strings that are not critical, e.g. the operator name reported by the network. But we should not do that on other types of strings, e.g. on SMS contents that may really have additional purposes than just being human-readable. This commit makes the transliteration option to be explicitly requested by the caller.
2021-02-23charsets: remove unused charset_utf8_to_hex() methodAleksander Morgado
2021-02-23charsets: don't allow quoting in byte_array_append()Aleksander Morgado
There's no point in adding a quoting option to this method; if the caller needs the appended string quoted, it should quote it before passing it to this method. It was nowhere used anyway.
2021-02-23charsets: remove HEX charset typeAleksander Morgado
This is no real charset, it is the fake one we used to represent a UCS2 hex-encoded string.
2021-02-23charsets: define charset enum explicitly as flagsAleksander Morgado
2020-08-20charsets: refactor coding styleAleksander Morgado
Mostly to use GLib types like gchar or gint, and also to use G_N_ELEMENTS() instead of custom end of array terminating items.
2020-08-20charsets: add UTF-16BE as a possible modem charsetAleksander Morgado
Just as an implementation detail to be taken as an extension of UCS2BE, never really to be used as a real modem charset.
2020-04-08charsets: report GError in byte_array_append() failuresAleksander Morgado
2018-08-21charsets: new helper to convert binary input data to UTF-8Aleksander Morgado
Most of all the other APIs we have are expecting binary data (e.g. UCS-2 encoded strings) in ASCII hex format, because they were going to be used in text AT commands. For binary protocols allowing binary data, we need use a more generic API that provides an explicit data size.
2017-08-16charsets: simplify check to see if conversion to charset possibleAleksander Morgado
Instead of having a method that returns the expected length after the conversion and the amount of input UTF-8 characters that couldn't be converted to the given charset, simplify the logic and just define a method that returns a boolean specifying whether the conversion is possible or not. Also, include unit tests.
2017-08-16charsets: ensure all methods are prefixed with 'mm_'Aleksander Morgado
2012-09-12core: better handling of non-UCS2 conversions that should be UCS2 (bgo #683817)Dan Williams
Some modems return the +COPS operator name in hex-encoded current character set (as set with +CSCS). Others return the operator name in ASCII when set to UCS2, while yet others return the ASCII name with trash at the end (*cough* Huawei *cough*). Handle that better by not crashing.
2012-03-16charsets: new UTF-8 to given charset converterAleksander Morgado
UCS-2 strings are always hex-converted.
2012-02-07charsets: new method to do our best to convert from current charset to UTF-8Aleksander Morgado
This method will try to convert the input string to UTF-8. The input string is supposed to be in the given charset; or otherwise is supposed to be the hex representation of the string in the given charset.
2012-01-17gsm: add SMS PDU creation functionDan Williams
Only for basic SMS-SUBMIT PDUs at the moment, and doesn't support large SMSs yet.
2011-06-06charsets: new utf8_to_hex() methodAleksander Morgado
2011-04-14gsm: implement basic SMS reception and PDU parsingNathan Williams
2011-04-14charset: change GSM unpack to take number of characters rather than octetsNathan Williams
Change interface to take the number of GSM characters rather than the number of octets, so that it is possible to distinguish the 7-character and 8-character cases.
2010-09-04gsm: add GSM 03.38 pack/unpack functions and testcasesDan Williams
2010-09-02gsm: add GSM 03.38 encoding/decoding functions and testcasesDan Williams
2010-03-16gsm: fix operator name on Option devices with UCS2 charsetDan Williams
2010-03-15core: add command helper that handles character set conversionDan Williams
2010-03-13core: move charset enum/string conversion to it's own fileDan Williams