diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2020-11-26 23:07:11 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-02-23 11:35:11 +0000 |
commit | 5ce97abd73da12b64393be798f2c294d29be2705 (patch) | |
tree | 48010cd5880f1dc07fd24e2156ecd7fd9290622b /src/tests | |
parent | 5480cb67b283c078770b02766c37768cb0930d7b (diff) |
charsets: make translit optional in gsm_unpacked_to_utf8()
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.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test-charsets.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tests/test-charsets.c b/src/tests/test-charsets.c index a15e0332..b18c11b1 100644 --- a/src/tests/test-charsets.c +++ b/src/tests/test-charsets.c @@ -30,6 +30,7 @@ common_test_gsm7 (const gchar *in_utf8) g_autofree guint8 *packed_gsm = NULL; g_autofree guint8 *unpacked_gsm_2 = NULL; g_autofree gchar *built_utf8 = NULL; + g_autoptr(GError) error = NULL; /* Convert to GSM */ unpacked_gsm = mm_charset_utf8_to_unpacked_gsm (in_utf8, &unpacked_gsm_len); @@ -58,8 +59,9 @@ common_test_gsm7 (const gchar *in_utf8) g_assert_nonnull (unpacked_gsm_2); /* And back to UTF-8 */ - built_utf8 = (gchar *) mm_charset_gsm_unpacked_to_utf8 (unpacked_gsm_2, unpacked_gsm_len_2); + built_utf8 = (gchar *) mm_charset_gsm_unpacked_to_utf8 (unpacked_gsm_2, unpacked_gsm_len_2, FALSE, &error); g_assert_nonnull (built_utf8); + g_assert_no_error (error); g_assert_cmpstr (built_utf8, ==, in_utf8); } |