Liste des Groupes | Revenir à cl c |
On 21/02/2025 20:45, Keith Thompson wrote:Exactly. This is the reply to AT+CMGR command that is standardized in 3GPP TS 27.005.pozz <pozzugno@gmail.com> writes:My understanding here is that the OP is getting the UCS-2 encoded string in from a modem, almost certainly on a serial line. The UCS-2 encoded data is itself a binary sequence of 16-bit code units, and the modem firmware is sending those as four hex digits. This is a very common way to handle transmission of binary data in such systems - there is no need for escapes or other complications to delimit the binary data. I would expect that the entire incoming message will be comma-separated fields with the time and date, sender's telephone number, and so on, as well as the text itself as this long hex string.I want to write a simple function that converts UCS2 string into ISO8859-1:>
>
void ucs2_to_iso8859p1(char *ucs2, size_t size);
>
ucs2 is a string of type "00480065006C006C006F" for "Hello". I'm
passing size because ucs2 isn't null terminated.
Is the UCS-2 really represented as a sequence of ASCII hex digits?
>
In actual UCS-2, each character is 2 bytes. The representation for
"Hello" would be 10 bytes, either "\0H\0e\0l\0l\0o" or
"H\0e\0l\0l\0o\0", depending on endianness. (UCS-2 is a subset of
UTF-16; the latter uses longer sequences to represent characters
outside the Basic Multilingual Plane.)
>
Les messages affichés proviennent d'usenet.