German Umlaute üöä ÜÖÄ

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Kai
Posts: 37
Joined: Fri Dec 15, 2017 10:43 am
Location: D

German Umlaute üöä ÜÖÄ

Post 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
Attachments
artikel.zip
(29.78 KiB) Downloaded 131 times
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

German Umlaute üöä ÜÖÄ

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

German Umlaute üöä ÜÖÄ

Post by wriedmann »

Hi Kai,
I forgot: what are the language settings of your VO application?
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Kai
Posts: 37
Joined: Fri Dec 15, 2017 10:43 am
Location: D

German Umlaute üöä ÜÖÄ

Post 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
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

German Umlaute üöä ÜÖÄ

Post 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
04-09-2022_15-39-46.png (78.79 KiB) Viewed 972 times
I have to lookup the header.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Kai
Posts: 37
Joined: Fri Dec 15, 2017 10:43 am
Location: D

German Umlaute üöä ÜÖÄ

Post 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
Attachments
artikel.jpg
artikel.jpg (93.01 KiB) Viewed 972 times
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

German Umlaute üöä ÜÖÄ

Post 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!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

German Umlaute üöä ÜÖÄ

Post 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?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

German Umlaute üöä ÜÖÄ

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

German Umlaute üöä ÜÖÄ

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply