Page 1 of 1
mui.CreateObject and umlauts
Posted: Wed Dec 24, 2014 4:12 pm
by evil
Hello!
I have prolems with mui.createobject and german umlauts (I think, the problem will occur with other languages special letters,too).
As an exmple I take your MUI-Royale Example Dynamic1.hws
I replaced the wort "two" in line 7 of dynamic.xml to "zwö".
When I now display Dynamic1.hws, It will start correctly,as the gui will be opened with mui.creategui.
But when I click on "Newwindow", I will get an error message:
Error parsing XML: not well-formed (invalid token) (Line: 7)
File Dynamic1.hws (current line: 76 - In Function: CreateObject)
A Bug??
Merry Christmas!
George
Re: mui.CreateObject and umlauts
Posted: Fri Dec 26, 2014 11:02 pm
by airsoftsoftwair
No, it's not a bug. If you don't specify an encoding, XML will fall back to UTF-8 and "ö" is not a valid UTF-8 character, thus causing an error. So you either have to pass the correct UTF-8 code for "ö" or simply set the encoding to ISO 8859-1 by always starting your XML declarations with the following header:
Code: Select all
<?xml version="1.0" encoding="iso-8859-1"?>
Then it will work fine.
Re: mui.CreateObject and umlauts
Posted: Mon Dec 29, 2014 12:39 am
by evil
Okay.
My program will be localised.
It creates the xml-file in realtime while startup up.
That means, Artbase creates a new file and uses 1000s of
WriteLine() to write a complete XML-file.
( there were other problems, which treated me to do it this way...).
This file contains the localised strings (about 350) for each supported language.
For german, I could use 8859-1. Does this encoding also run for polish chars (8859-2)??
If not, is there a workaround?
Would it be better, to change those strings later (after creation) with mui.set (id,contents)??
How would this work with "shorthelp"-strings?
Is there any other way to localise xml-files
Regars
George
Re: mui.CreateObject and umlauts
Posted: Mon Dec 29, 2014 11:53 pm
by airsoftsoftwair
evil wrote:It creates the xml-file in realtime while startup up.
That means, Artbase creates a new file and uses 1000s of Writeline() to write a complete XML-file.
( there were other problems, which treated me to do it this way...).
You don't have to use a file for this. You can just create it in a string and then pass this string to mui.CreateObject(). Many people wrongly assume that the XML definition has to be external because all my examples do it that way. But it's perfectly ok to create them in a string.
This file contains the localised strings (about 350) for each supported language.
For german, I could use 8859-1. Does this encoding also run for polish chars (8859-2)??
If not, is there a workaround?
No, MUI Royale only supports ISO 8859-1 and UTF-8 in its XML files. So if you need Eastern European characters, you have to use UTF-8.
Would it be better, to change those strings later (after creation) with mui.set (id,contents)??
How would this work with "shorthelp"-strings?
Changing the strings at runtime can be problematic because AFAIK MUI always uses the system's default charset and there's currently no way of passing UTF-8 to MUI directly. That's why you are better of doing as much as possible at creation time.
Re: mui.CreateObject and umlauts
Posted: Tue Dec 30, 2014 3:26 am
by evil
You don't have to use a file for this. You can just create it in a string and then pass this string to mui.CreateObject(). Many people wrongly assume that the XML definition has to be external because all my examples do it that way. But it's perfectly ok to create them in a string.
I know, but the whole xml-file is about 400kb in size. Its easier for me to put it into a file, first.
Also as it is localised, it would get more comples when adding hundreds of "..cat$[x].." into the string...
No, MUI Royale only supports ISO 8859-1 and UTF-8 in its XML files. So if you need Eastern European characters, you have to use UTF-8.
So I use ISO 8859-1 at the moment. My polish translator uses 8859-2 for cataloging. Does he see the correct letters inside ArtBase then??
Or are those "polish-specific" letters displayed wrong on his system???
Changing the strings at runtime can be problematic because AFAIK MUI always uses the system's default charset and there's currently no way of passing UTF-8 to MUI directly. That's why you are better of doing as much as possible at creation time.
Ok. So I will do it the standard way... as before....
Thanx!
George
Re: mui.CreateObject and umlauts
Posted: Tue Dec 30, 2014 10:59 am
by airsoftsoftwair
So I use ISO 8859-1 at the moment. My polish translator uses 8859-2 for cataloging. Does he see the correct letters inside ArtBase then??
Or are those "polish-specific" letters displayed wrong on his system???
Yes, he should. He should provide the translated texts as UTF-8 and then you include them in an XML that uses UTF-8 encoding. Then everything should be displayed correctly on Polish systems (but not on your machine since your machine uses ISO 8859-1.... but you can test it on your machine, too, by simply switching language and charset to Polish temporarily).
Re: mui.CreateObject and umlauts
Posted: Tue Dec 30, 2014 2:59 pm
by evil
Quite confusing at all...
Well, I will let him test the actual version and we will see....
Thanx for explanation!!
Best regards
George