Page 1 of 3
German Umlaute üöä ÜÖÄ
Posted: Sat Sep 03, 2022 3:56 pm
by Kai
Hello everyone!
I'm still testing various things in XSharp and XIDE before attempting to migrate my applications from VO to XSharp.
Now I have some Problems with german "Umlaute" (äöü ÄÜÖ ß). I have a .dbf database with items like "Hähnchenschnitzel" and so on.
In VO I have no Problems with code like this:
oTB := TextBox{, "Test", oDBServer:Fieldget("Bez")}
oTB:Show()
The Textbox shows "Hähnchenschnitzel" with the correct "ä".
In XSharp the Textbox shows some kind of special character instead of the "ä"
I've tried using SetAnsi(FALSE), SetAnsi(true), Ansi2OEM(), OEM2Ansi() but nothing works. With Ansi2OEM() the small "äöü" are displayed correctly, but the large "ÄÖÜ" are still displayed as special charcters.
How can I get XSharp to work properly with these characters?
I have included an example .dbf in the attachments. For example please look at the record numbers 10 / 11 / 12 / 25 / 85.
Regards
Kai
German Umlaute üöä ÜÖÄ
Posted: Sat Sep 03, 2022 6:25 pm
by wriedmann
Hi Kai,
do you have any samples of code how do you access your DBF tables?
Wolfgang
P.S. I'm using several X# applications that access the same DBFs as VO applications - in different formats: VOOGUI, WPF, Windows Forms, Windows services
German Umlaute üöä ÜÖÄ
Posted: Sat Sep 03, 2022 6:26 pm
by wriedmann
Hi Kai,
I forgot: what are the language settings of your VO application?
Wolfgang
German Umlaute üöä ÜÖÄ
Posted: Sun Sep 04, 2022 1:06 pm
by Kai
Hi Wolfgang!
Here the xSharp-code. It uses the artikel.dbf which i attached in the first post.
[STAThread];
FUNCTION Start() AS INT
LOCAL oXApp AS XApp
TRY
oXApp := XApp{}
oXApp:Start()
CATCH oException AS Exception
ErrorDialog(oException)
END TRY
RETURN 0
CLASS XApp INHERIT App
METHOD Start()
LOCAL oDBServer AS DBServer
LOCAL oTB AS TextBox
SetCentury(TRUE)
SetDateCountry(GERMAN)
SetExclusive(FALSE)
SetSoftSeek(FALSE)
SetDeleted(TRUE)
RddSetDefault("DBFCDX")
SetAnsi(FALSE)
SetAmPm(FALSE)
oDBServer := DBServer{"c:xsharpartikel.dbf", DBSHARED, FALSE, "DBFCDX"}
oDBServer:GoTo(83)
oTB := TextBox{, "Artikel", AllTrim(oDBServer:FieldGet("bBez1"))}
oTB:Show()
oDBServer:Close()
SELF:Quit()
RETURN SELF
German Umlaute üöä ÜÖÄ
Posted: Sun Sep 04, 2022 1:40 pm
by wriedmann
Hi Kai,
there is something strange with your DBF: even my VO Dictionary Editor does not shows the correct umlaut data.
- 04-09-2022_15-39-46.png (78.79 KiB) Viewed 892 times
I have to lookup the header.
Wolfgang
German Umlaute üöä ÜÖÄ
Posted: Sun Sep 04, 2022 1:54 pm
by Kai
Hi Wolfgang!
My VO application shows everything as it should be. I have attached an image. This VO-Application uses a simple DataBrowser. The artikel.dbf was created by DBFileSpec:create()
The VO App:Start() -Method uses the following commands, everything else like DBServer and so an is VO-standard without modifications:
SetCentury(TRUE)
SetDateCountry(GERMAN)
SetExclusive(FALSE)
SetSoftSeek(FALSE)
SetEpoch(1930)
SetDeleted(TRUE)
RddSetDefault("DBFCDX")
SetAnsi(FALSE)
SetAmPm(FALSE)
Regards
Kai
German Umlaute üöä ÜÖÄ
Posted: Sun Sep 04, 2022 3:45 pm
by Chris
Hi Kai, Wolfgang,
Wolfgang, the dbf is created with SetAnsi() off, so you need to use a SetAnsi(FALSE) in VO, in order to open it correctly.
But indeed, the same thing does not work correctly in X#. I suspect there's some issue with the recognition of the codepage of the dbf, or there's something iffy in the dbf handling in X# with SetAnsi(FALSE), will open a report for Robert to look more closely into it. Thanks for the report!
German Umlaute üöä ÜÖÄ
Posted: Mon Sep 05, 2022 5:54 am
by Chris
Guys,
Ah, sorry, my previous comment was wrong, SetAnsi(FALSE) should be used in VO only when creating the dbf, in order to create it in OEM format, but SetAnsi(TRUE) should still be used to read it (or otherwise use Oem2Ansi() manually to convert the string read from OEM/DOS format(codepage) to windows readable ANSI).
So I think Wolfgang is right, there seems to be a problem with the dbf, having the wrong codepage in its header, or format of the data. Kai, how did you create this dbf? Can you also post an aef of a small VO sampleapp showing how you are opening and showing this dbf?
German Umlaute üöä ÜÖÄ
Posted: Mon Sep 05, 2022 6:41 am
by wriedmann
Hi Chris,
the strange thing is than when using the code Kai posted earlier and adapting it to VO it shows the correct output.
Code: Select all
function DisplayDBF() as void
LOCAL oDBServer AS DBServer
LOCAL oTB AS TextBox
SetCentury(TRUE)
SetDateCountry(GERMAN)
SetExclusive(FALSE)
SetSoftSeek(FALSE)
SetDeleted(TRUE)
RddSetDefault("DBFCDX")
SetAnsi(FALSE)
SetAmPm(FALSE)
oDBServer := DBServer{"c:tempartikel.dbf", DBSHARED, FALSE, "DBFCDX"}
oDBServer:GoTo(83)
oTB := TextBox{, "Artikel", AllTrim(oDBServer:FieldGet("bBez1"))}
oTB:Show()
oDBServer:Close()
RETURN
I have pasted this code into a standard VO Console application.
Wolfgang
German Umlaute üöä ÜÖÄ
Posted: Mon Sep 05, 2022 6:50 am
by wriedmann
Hi Chris,
following the previous message: the sample application uses SetAnsi( false ), so no conversion is done.
If the DBF is created to use OEM characters, and opened with SetAnsi( false ), then the data is written as ANSI, regardless of the charset that is used in the DBF header. Any application that respects this header will show wrong data.
The problem could be that X# probably with SetAnsi( true ) does not makes the conversion from the ANSI (that should be used when SetAnsi() is false) to Unicode (that is used internally in .NET).
Wolfgang