summaryrefslogtreecommitdiff
path: root/src/fe-common/core/utf8.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-common/core/utf8.c')
-rw-r--r--src/fe-common/core/utf8.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/fe-common/core/utf8.c b/src/fe-common/core/utf8.c
index ae235d34..eaa77674 100644
--- a/src/fe-common/core/utf8.c
+++ b/src/fe-common/core/utf8.c
@@ -182,6 +182,24 @@ void utf16_to_utf8(const unichar *str, char *out)
*out = '\0';
}
+void utf16_to_utf8_with_pos(const unichar *str, int spos, char *out, int *opos)
+{
+ int len;
+ const unichar *sstart = str;
+ char *ostart = out;
+
+ *opos = 0;
+ while (*str != '\0') {
+ len = utf16_char_to_utf8(*str, out);
+ out += len;
+
+ str++;
+ if(str - sstart == spos)
+ *opos = out - ostart;
+ }
+ *out = '\0';
+}
+
static const unichar wcc[] = {
0x0, 0x300, 0x34F, 0x360, 0x363, 0x483, 0x487, 0x488, 0x48A, 0x591,
0x5A2, 0x5A3, 0x5BA, 0x5BB, 0x5BE, 0x5BF, 0x5C0, 0x5C1, 0x5C3, 0x5C4,