Umlaute aus DBF von VO nach X# nicht korrekt

Deutschsprachiges X#-Forum – German language forum

Moderator: wriedmann

Post Reply
lagraf
Posts: 419
Joined: Thu Jan 18, 2018 9:03 am

Umlaute aus DBF von VO nach X# nicht korrekt

Post by lagraf »

Hallo,
ich bin beim Testen einer von VO nach X# transportierten App mit DBF Files. In VO habe ich folgende initial settings:

Code: Select all

	SetAnsi          (FALSE)
	SetCollation     (#CLIPPER)
	SetInternational (#CLIPPER)
  	SetDateCountry   (GERMAN)
	SetNatDLL		  ("GERMAN.DLL")
Wenn ich mit X# die DBF Daten auslese, bekomme ich falsche Umlaute bei Daten aus den DBFs angezeigt.
Korrigiere ich die Umlaute in X# sind sie in VO wieder falsch.
Welche Einstellungen brauche ich in X#, damit die Umlaute korrekt angezeigt und eingegeben werden?
Attachments
agr.jpg
User avatar
Chris
Posts: 4573
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Umlaute aus DBF von VO nach X# nicht korrekt

Post by Chris »

Hi Franz,

Can you please send the dbf to have a look? Need to check its ansi setting.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
lagraf
Posts: 419
Joined: Thu Jan 18, 2018 9:03 am

Re: Umlaute aus DBF von VO nach X# nicht korrekt

Post by lagraf »

Hi Chris,
the attached Dbf from Topic "Beim Öffnen einer DBF steht EOF auf .t." is one of these Dbfs.
Franz
User avatar
Chris
Posts: 4573
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Umlaute aus DBF von VO nach X# nicht korrekt

Post by Chris »

Hi Franz,

Thanks for the report, it is indeed a bug in X# with handling OEM (SetAnsi(FALSE)) dbfs, I opened a report here: https://github.com/X-Sharp/XSharpPublic/issues/1449

In the meantime, can't you use SetAnsi(TRUE) instead (both for opening and creating the dbfs)? I think the only reason for using OEM dbfs is for compatibility with old clipper dbfs.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
lagraf
Posts: 419
Joined: Thu Jan 18, 2018 9:03 am

Re: Umlaute aus DBF von VO nach X# nicht korrekt

Post by lagraf »

Hi Chris,

Code: Select all

CLASS dbStandard INHERIT dbServer
CONSTRUCTOR (cFileName, lDbShared, lReadOnly) 
	LOCAL cDbf AS STRING

	SetAnsi(TRUE)	// Umlaute in DBF
	
	Default (@lReadOnly, FALSE)
	Default (@lDbShared, TRUE)

	cDbf := dbFileSpec{cFileName + ".DBF"}:FullPath
	SUPER:init (cDbf, lDbShared, lReadOnly)
	SELF:concurrencyControl := CCNONE
	IF File(StrTran(cDbf, ".DBF", ".CDX"))
		SELF:setIndex (StrTran(cDbf, ".DBF", ".CDX"))
	ENDIF
	
	SELF:GoTop()	// In X# steht Server nach dem Öffnen auf EOF

	RETURN SELF
This SetAnsi(TRUE) does not have any effect, Umlauts are still wrong!
Franz
User avatar
Chris
Posts: 4573
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Umlaute aus DBF von VO nach X# nicht korrekt

Post by Chris »

Hi Franz,

Yes, that's because the dbf must also be (re)generated with having SetAnsi(TRUE) first (from either X# or VO). Then it will work the same from both X# and VO.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
lagraf
Posts: 419
Joined: Thu Jan 18, 2018 9:03 am

Re: Umlaute aus DBF von VO nach X# nicht korrekt

Post by lagraf »

Hi Chris,
that means that I have to
- rename all DBFs (about 30)
- create all DBFs new with SetAnsi(TRUE)
- copy all recs from renamed DBFs to new DBFs
- delete renames DBFs

Or another way maybe?
- Run through all DBFs, update char fields with replaced Umlauts

Many things to do!
Franz
User avatar
Chris
Posts: 4573
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: Umlaute aus DBF von VO nach X# nicht korrekt

Post by Chris »

Hi Franz,

The dbfs need to be recreated with the new ANSI setting, so you need the first option. Of course you can write a small utility app to do it automatically, if you want I can create one for you.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
lagraf
Posts: 419
Joined: Thu Jan 18, 2018 9:03 am

Re: Umlaute aus DBF von VO nach X# nicht korrekt

Post by lagraf »

Hi Chris,
thank you, but I can do this by myself. I already have some DBF upgrade routines in this app which do similar.
Franz
Post Reply