NetTalk Central

Author Topic: diacritic characters from json to sql server  (Read 2258 times)

joep

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
    • Email
diacritic characters from json to sql server
« on: March 05, 2025, 01:22:34 AM »
Hi all,
I have a webservice which consumes a json file.
I use stringTheory to load the json file: 
str.SetValue(Self.ThisPage.GetValue())

I use the stringTheory "between" method to get values.
lTagwaarde = str.Between('"' & Clip(Tot:RecString1) & '":',',"',lPositieGetuige)

But when I try to save this value in the database the diacritic characters get misformed.
The text Arag?nstraat becomes Aragónstraat in sql server

I use clarion add(xml002) and prop:sql to insert it into the database.
The database field is nvarchar and the collate is SQL_Latin1_General_CP1_CI_AS

What should I do get this diacritic value wright?

Regards Joep

joep

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
    • Email
Re: diacritic characters from json to sql server
« Reply #1 on: March 05, 2025, 10:50:27 PM »
Hi all

I have got the solution.
What I do is read the Json from the webservice with the following code with stringTheory (str):
str.SetValue(Self.ThisPage.GetValue(),st:EncodeUtf8)

And before saving the record to the sql server database:
str.ToAnsi(st:EncodeUtf8,st:CP_WINDOWS_1252)

Cheers Joep