summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyuho Jo <kyuho.jo@samsung.com>2016-03-18 16:15:32 +0900
committerKyuho Jo <kyuho.jo@samsung.com>2016-03-18 16:15:32 +0900
commit9b3685a0f37595527c34eb518deabb8ed3b90937 (patch)
treef9f27bb671b1fb1c92445928a01001b3a1e30f93
parent6094149b43eeaaf5ecd6e22feb09e9050aa30e05 (diff)
downloadair_mediahub-9b3685a0f37595527c34eb518deabb8ed3b90937.tar.gz
air_mediahub-9b3685a0f37595527c34eb518deabb8ed3b90937.tar.bz2
air_mediahub-9b3685a0f37595527c34eb518deabb8ed3b90937.zip
Changes for handling unicode text.
Change-Id: Ib031a77bfda736e65c8ceb88b370316786e19af9 Signed-off-by: Kyuho Jo <kyuho.jo@samsung.com>
-rw-r--r--CMakeLists.txt1
-rw-r--r--packaging/org.tizen.mediahub.spec1
-rw-r--r--src/data/mediadata.c50
3 files changed, 51 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7a8ab50..21f77cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,7 @@ pkg_check_modules(PKGS REQUIRED
capi-ui-efl-util
capi-maps-service
vconf
+ capi-base-utils-i18n
app-utils)
IF(NOT DEFINED PACKAGE_NAME)
diff --git a/packaging/org.tizen.mediahub.spec b/packaging/org.tizen.mediahub.spec
index d17f354..c2aed7c 100644
--- a/packaging/org.tizen.mediahub.spec
+++ b/packaging/org.tizen.mediahub.spec
@@ -17,6 +17,7 @@ BuildRequires: pkgconfig(capi-ui-efl-util)
BuildRequires: pkgconfig(capi-maps-service)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(app-utils)
+BuildRequires: pkgconfig(capi-base-utils-i18n)
BuildRequires: pkgconfig(libtzplatform-config)
%define _appdir %{TZ_SYS_RO_APP}/%{name}
diff --git a/src/data/mediadata.c b/src/data/mediadata.c
index a31a3da..89618b7 100644
--- a/src/data/mediadata.c
+++ b/src/data/mediadata.c
@@ -18,6 +18,7 @@
#include <media_content.h>
#include <app_debug.h>
#include <app_media.h>
+#include <utils_i18n.h>
#include "data/datamgr.h"
@@ -162,7 +163,54 @@ static char *_get_title(app_media_info *info)
if (!info->title)
return NULL;
- return strndup(info->title, 1);
+ int buffer_length = 0;
+ i18n_error_code_e error_from_i18n;
+ char *result_str = NULL;
+ i18n_uchar *converted_str = NULL;
+ i18n_uchar sub_string[10] = { 0, };
+
+ /* Calc buffer size for converted UTF16 string */
+ i18n_ustring_from_UTF8(NULL, 0, &buffer_length, info->title, -1, &error_from_i18n);
+
+ converted_str = malloc((buffer_length + 2) * sizeof(i18n_uchar));
+ if (converted_str == NULL) {
+ _ERR("malloc failed");
+ goto OUT;
+ }
+
+ /* Convert to i18n(UTF16) string */
+ i18n_ustring_from_UTF8(converted_str, buffer_length + 1, &buffer_length, info->title, -1, &error_from_i18n);
+ if (error_from_i18n != I18N_ERROR_NONE) {
+ _ERR("i18n_ustring_from_UTF8 returns [%d]", error_from_i18n);
+ goto OUT;
+ }
+ converted_str[buffer_length] = (i18n_uchar)0;
+
+ /* Get a character (not a byte) from left */
+ i18n_ustring_copy_n(sub_string, converted_str, 1);
+ i18n_ustring_to_UTF8(NULL, 0, &buffer_length, sub_string, -1, &error_from_i18n);
+
+ result_str = malloc((buffer_length + 2) * sizeof(char));
+ if (result_str == NULL) {
+ _ERR("malloc failed");
+ goto OUT;
+ }
+
+ /* Convert to UTF8 */
+ i18n_ustring_to_UTF8(result_str, buffer_length + 1, &buffer_length, sub_string, -1, &error_from_i18n);
+ if (error_from_i18n != I18N_ERROR_NONE) {
+ _ERR("i18n_ustring_to_UTF8 returns [%d]", error_from_i18n);
+ free(result_str);
+ result_str = NULL;
+ goto OUT;
+ }
+ result_str[buffer_length] = '\0';
+
+OUT:
+ if (converted_str)
+ free(converted_str);
+
+ return result_str;
}
static int _compare_time(struct group_info *gi, app_media_info *info)