Page 1 of 1
German umlaut
Posted: Thu Sep 10, 2015 12:30 am
by CyborgDE
Hello,
I have a German umlaut "ü" in a button, in the windows simulation, it looks good. In the Browser (IE) it looks like "ü" ...
Regards,
Uwe
Re: German umlaut
Posted: Wed Sep 16, 2015 8:03 am
by JS-Support @Userware
Hello Uwe,
Thanks for your message.
I am attempting to reproduce the issue but with no avail.
I have created a new Empty project and tried the following XAML code:
Code: Select all
<TextBlock Text="ü" FontSize="30"/>
Please look at the attached screenshot to see the code, and the result. In the screenshot you can see both the Chrome-based Simulator and IE 10 running.
- Bug German umlaut.png (80.38 KiB) Viewed 8061 times
Can you please send me some other code snippet to reproduce it?
Thanks a lot,
Regards,
JS-Support
Re: German umlaut
Posted: Wed Sep 16, 2015 11:39 am
by CyborgDE
Hello,
I have a XmlReader
Code: Select all
var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(script));
var xmlReader = XmlReader.Create(memoryStream);
an the command
Code: Select all
xaml = xmlTextReader.ReadElementString();
produce the effect under java, windows is OK !?
Any Idea ?
Regards, Uwe
Re: German umlaut
Posted: Sat Oct 17, 2015 12:30 am
by CyborgDE
Help !!!
The XmlRead can not deal with UTF-8 data !!!
The "ü" ist "\xfc" ...
Regards,
Uwe
Re: German umlaut
Posted: Sat Oct 17, 2015 7:28 am
by CyborgDE
This little piece of code solves the problem, for now.
But why ?
Code: Select all
_Value = xmlTextReader.ReadElementString();
if (CSharpXamlForHtml5.Environment.IsRunningInJavaScript)
{
byte[] vals = new byte[_Value.Length];
for (int i = 0; i < _Value.Length; i++)
{
char ch = _Value[i];
if (ch < 128)
{
vals[i] = (byte)ch;
}
else
{
byte code = JSIL.Verbatim.Expression("ch.charCodeAt(0)");
vals[i] = code;
}
}
_Value = Encoding.UTF8.GetString(vals);
}
Here is the input file loaded via the WebClient :
Code: Select all
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<TransList>
<Language>ru</Language>
<TransItem>
<Key> Suchen</Key>
<Value> Поиск</Value>
</TransItem>
</TransList>
Regards, Uwe