NetTalk Central

Author Topic: Encoding in a webservice?  (Read 3361 times)

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Encoding in a webservice?
« on: February 25, 2015, 03:25:57 AM »
Hi,
As a supplement to my web app I have a webservice that handles the creation of new users & databases on the fly. Both apps have Charset=utf-8 and StoreDataAs=Scandinavian.

When a new user with special characters in the name signs up, the special characters do not get encoded correctly in the database. So my question is: do I have to manually encode the fields that get passed to the webservice before storing them in the database - or is this an oversight by the developer?

Thanks
Peter

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Encoding in a webservice?
« Reply #1 on: February 25, 2015, 05:00:18 AM »
Hi Peter,

so, just to be clear,
the incoming parameters are containing utf-8
which you then (presumably) want to convert to Scandinavian
before the records get written to the database?

cheers
Bruce


peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Encoding in a webservice?
« Reply #2 on: February 25, 2015, 05:50:15 AM »
Hi Bruce,

Arrgh - it turned out that I was utf-8 encoding the parms before making the SOAP call. After setting xml.SaveEncoding = 'ISO-8859-1' instead everything looks fine in the data base. I guess NT was encoding my already encoded string leading to the funny result I was seing.

So: if I pass utf-8 encoded parameters to my web service then I must decode them before writing them to the data base (since NT automatically encodes according to the settings on the net simple object).

Did I get this right?

Thanks
Peter

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Encoding in a webservice?
« Reply #3 on: February 26, 2015, 04:39:26 AM »
Hi Peter,

I think it should be all automatic - but I need to test that and make sure it's all as smooth as it should be.

cheers
Bruce