German umlauts in iOS missing

Hi,

I have a problem, maybe Haxe 4.0.5 related. In iOS I do not see german umlauts and the strings are cut off after a occurrence of them, whereas I see the whole loca in Browser.

The loca comes from XML.
see: https://github.com/andreasdr/xfl/blob/master/openfl/lang/Locale.hx

Does anyone has the same problems? Any ideas?

Many thanx and

Best regards
Andreas

I have the same problem, but on Android. In Flash it works fine.

I have been able to get german umlauts working by adding/changing this in 8,9,6/src/openfl/_internal/text/TextLayout.hx

                    var bd: haxe.io.BytesData = new haxe.io.BytesData();
                    for (i in 0...text.length) {
                            bd.push(text.charCodeAt(i));
                            bd.push(0);
                            bd.push(0);
                            bd.push(0);
                    }
                    var textDP: lime.utils.DataPointer = lime.utils.DataPointer.fromBytesData(bd);
                    ...
                    --__hbBuffer.addUTF8...
                   ++ __hbBuffer.addCodepoints(textDP, -1, 0, -1);

However this is only a work around working for german umlauts.

I think it’s a Haxe 4 issue, I created a similar topic here.

1 Like

Yes, on my machine Strings(with Umlauts) are stored with ASCII/Latin1 when using native targets. I tried lots of stuff to get umlauts in an UTF8 string and to render it correctly with a TextField. Seems very tricky.
And some stuff is broken like Haxe.utf8.encode, decode, also other related functions. It took me 2-3 days to find this workaround.

1 Like

It really is problematic

@andreasdr correction seems to work for all iso numbers under <256 that use only 1 byte.
But I tried to show russian characters and I was unable to.

i tried subdivising the russian bytes into characters

for example , it didn’t work
bd.push(0x04);
bd.push(0x23);
bd.push(0);
bd.push(0);

1 Like

I have a problem, maybe Haxe 4.0.5 related.
I’ve tried with haxe 3.4 . It doesn’t seem to work for russian.
But everyone seems to says it’s haxe related
https://github.com/openfl/openfl/issues/2264
https://github.com/openfl/openfl/issues/2237

in src/openfl/_internal/text/TextLayout.hx , you can use

__hbBuffer.contentType = lime.text.harfbuzz.HBBufferContentType.UNICODE;
for (i in 0...text.length){
__hbBuffer.add(text.charCodeAt(i), i);
}

WORKS for “í” on Linux
Doesn’t work for russian on Linux
Works for “í” and russian on Android

__hbBuffer.addUTF16(untyped __cpp__('(uintptr_t){0}', text.wc_str()), text.length, 0, -1);

WORKS for “í” on Linux
Doesn’t work for russian on Linux
Works for “í” and russian on Android

__hbBuffer.addUTF8(text, 0, -1);

Doesn’t work for russian and “í” on Linux
Doesn’t work for russian and “í” on Android