#include <media_content.h>
#include <app_debug.h>
#include <app_media.h>
+#include <utils_i18n.h>
#include "data/datamgr.h"
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)