aboutsummaryrefslogtreecommitdiff
path: root/src/mm-sms-part-cdma.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2017-08-15 23:21:05 +0200
committerAleksander Morgado <aleksander@aleksander.es>2017-08-16 16:27:42 +0200
commit5a01e5406660bc4f5a3cf68254510e867f89a457 (patch)
tree584f237f83754ac84c10a569e5dbecdb6e9bb77d /src/mm-sms-part-cdma.c
parent1f2bb640284ef75e411658a3ff67f844bea8b260 (diff)
charsets: simplify check to see if conversion to charset possible
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.
Diffstat (limited to 'src/mm-sms-part-cdma.c')
-rw-r--r--src/mm-sms-part-cdma.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/mm-sms-part-cdma.c b/src/mm-sms-part-cdma.c
index 8d76bcec..167eda83 100644
--- a/src/mm-sms-part-cdma.c
+++ b/src/mm-sms-part-cdma.c
@@ -1365,7 +1365,6 @@ decide_best_encoding (const gchar *text,
guint *num_bits_per_field,
Encoding *encoding)
{
- guint latin_unsupported = 0;
guint ascii_unsupported = 0;
guint i;
guint len;
@@ -1391,10 +1390,7 @@ decide_best_encoding (const gchar *text,
}
/* Check if we can do Latin encoding */
- mm_charset_get_encoded_len (text,
- MM_MODEM_CHARSET_8859_1,
- &latin_unsupported);
- if (!latin_unsupported) {
+ if (mm_charset_can_convert_to (text, MM_MODEM_CHARSET_8859_1)) {
*out = g_byte_array_sized_new (len);
mm_modem_charset_byte_array_append (*out,
text,