SetAnsi(false) not needed in X# with ADS?

This forum is meant for questions and discussions about the X# language and tools
Post Reply
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

SetAnsi(false) not needed in X# with ADS?

Post by ic2 »

Frank works on an X# conversion and once he pastes an ANSI character in an SLE in a converted VO form, the character shows incorrect, unlike in VO. E.g.:

straße changes into straáe.

Once he runs SetAnsi(true) the problem is solved. However, we all use ADS which requires SetAnsi(false) to prevent both VO and ADS to convert OEM to ANSI.

Is my conclusion correct that this SetAnsi(false) is not required in X#, contrary to in VO (and that a false setting influences all kind of string manipulations, besided the mentioned sle paste e.g. a function building ansi characters also gave different results compared to in VO, in their program)

Dick
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Re: SetAnsi(false) not needed in X# with ADS?

Post by ic2 »

Robert, Chris, can you confirm this?

Dick
User avatar
Chris
Posts: 4897
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: SetAnsi(false) not needed in X# with ADS?

Post by Chris »

HI DIck,

Yes, indeed SetAnsi(FALSE) affects several things and normally is not needed in X#, unless you need to share dbfs with old programs written in Clipper etc. Are you sure ADS requires SetAnsi(FALSE)?
Chris Pyrgas

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

Re: SetAnsi(false) not needed in X# with ADS?

Post by wriedmann »

Hi Chris,
in VO SetAnsi( false ) is needed for ADS to stop conversions.
The ADS help says:
"In order for the Advantage RDD to work properly, the SetAnsi value must be False. The Advantage RDD takes care of all conversion and always returns the data in the native Windows format-ANSI. If you incorrectly set SetAnsi() to True in your Advantage application, Visual Objects will incorrectly assume the data from the Advantage RDD is not ANSI and will also perform conversion, which will corrupt your data. The Advantage Visual Objects RDD will use the SetCollation() value to determine if ANSI conversion is necessary as explained below."
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Re: SetAnsi(false) not needed in X# with ADS?

Post by ic2 »

Thanks Chris, Wolfgang, to add: the 'explanation below' from the ADS help as Wolfgang posted is:

"If the data is stored in the DBF as OEM data (to be shared with a Clipper application for example), it must also be collated using the Clipper collation sequence (which is ASCII for the English language). Therefore, add the line SetCollation( #Clipper ) to the beginning of the application (before any data files are opened). Since the data is stored as OEM characters, the data will be translated automatically by the RDD to ANSI for use with Visual Objects (because all Windows applications require data to be represented in the ANSI character set).

If the data is stored as ANSI characters, the RDD will need to collate the data using ANSI collation sequences. The data cannot be shared with DOS applications such as Clipper Therefore, add the line SetCollation( #Windows ) to your application before any data files are opened (this is the default). The RDD will read and write ANSI characters and no conversion will take place."

I can enter a >128 ANSI character in the VO version (ADS, SetAnsi(false)) which shows correctly in the X# version of the program (SetAnsi is not set and then it appears to be true) where I can do the same, the other way around.

Despite knowing the help text I am still not sure why it works correctly in VO with SetAnsi(false) -implying dbf is native Windows ANSI format and need no conversion, and SetAnsi(true) in X# (required to paste correct values in SLE's). But why isn't ADS here "incorrectly assuming the data from the Advantage RDD is not ANSI and will also perform conversion" as the help file says about VO?

(I mix the use of both; there are a few advantages in the X# version but not everything is yet converted)


Dick
User avatar
wriedmann
Posts: 3754
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Re: SetAnsi(false) not needed in X# with ADS?

Post by wriedmann »

Hi Dick,
do you have ever tried to put a euro character in an ADS database field? At least with VO I was never able to do that....
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4515
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: SetAnsi(false) not needed in X# with ADS?

Post by robert »

Guys,
ADS does the indexing on the server. So the collation is not really relevant, however the RDD asks the runtime for the current collation and derives the charset parameter for AdsOpenTable90() from the collation. Collation Clipper = ADS_OEM, Collation Windows is ADS_ANSI.
It does the same for the char parameter in AdsCreateTable90()
I do not see (in the Vulcan RDD) what ADS does with the SetAnsi() setting.
For VO I do not know this.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Re: SetAnsi(false) not needed in X# with ADS?

Post by ic2 »

wriedmann wrote: Mon Oct 14, 2024 3:30 pm Hi Dick,
do you have ever tried to put a euro character in an ADS database field? At least with VO I was never able to do that....
Wolfgang
Certainly, no problem. I can add it in a VO or a (Winforms) X# SLE, save it and it stores in the (ADS driven) DBF like any other >CHR(128) character.

Here's how it looks like in my DBV utility (again: all is opened under ADS):
euroindbf.jpg
euroindbf.jpg (7.17 KiB) Viewed 670 times
I wonder why you can't while the ß is no problem?

I also understand from the reply from Robert that it is a bit a black box how the RDD's and ADS work. So I have to rely on what seems to work: SetAnsi(false) in VO as that is required according to the ADS help and no SetAnsi setting (apparently meaning that it's true) in the X# program. Then I have to make sure that the DBF's themselves are ANSI (you can see that in dbMax, Database and RDD info, and also export a DBF as OEM or ANSI there) and then we open all our dbf's in ADS and then it seems to work fine as far as I can see, mixing the use of an X# and VO version of the same program.

Dick
Luc
Posts: 28
Joined: Sat Apr 30, 2016 7:31 pm
Location: Belgium

Re: SetAnsi(false) not needed in X# with ADS?

Post by Luc »

Hi Dick, Wolfgang,

Just as info:

In the VO program I had:
SetAnsi(FALSE)
SetCollation(#CLIPPER)


in x# I use:
SetAnsi(False)
SetCollation(#ordinal)

Only with the #ordinal the use of accents (and the euro sign) is correct in X#. The same record shows ok in data architect, vo and x#.

I use ADS with ADT tables. The server is setup with oem and ansi as DUTCH, DUTCH

p.s. : the euro sign was never an issue in VO, only in x# with the collation #clipper.
straße also works in vo and x#.

grtz,
Luc
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

Re: SetAnsi(false) not needed in X# with ADS?

Post by ic2 »

Hello Luc,

Very interesting as I get the correct results mixing the VO & X# program with SetAnsi(true). I don't set SetCollation but that shouldn't influence the actual strings, only the string comparisons.

So we have now:

1 SetAnsi(true) in X# with ADS and DBFCDX and SetAnsi(false) for VO mixed use on the same databases: works for me
2 SetAnsi(false) in X# pastes wrong values in VO forms SLE's for >128 characters for Frank. But not in my Winforms based program however.
3 SetAnsi(false in X# with ADS and ADT and SetAnsi(false) for VO: works for you.

You (also) do not get wrong values in SLE's? Why does Frank get them? 1 & 3 suggest that it doesn't matter what you set in X# with ADS. But then: what causes the incorrect pasted values for Frank? Or would there be any difference because you use ADT? And are the incorrect pasted values only in VO forms and not in Winforms perhaps?

Dick
Post Reply