Page 1 of 1

Failure posting to Azure accented characters content

Posted: Tue Sep 26, 2023 1:45 pm
by trevix
My standalone posts user registration data to Microsoft Azure, where the registration/login process is handled.

Today (sigh) after 2 years, I discovered that the post fails if there is an accented char on the registering user name.
Please note that the accented char is not a problem if the registration is made on Swagger, where it is successful .
Also, without accented characters the registration in LC is fine.

This example, on OSX 12.6.9, returns the following error (please note the "Paltò" in the user firstName):
it =
{"type":"https://tools.ietf.org/html/rfc7231#sec ... itle":"One or more validation errors occurred.","status":400,"traceId":"00-1ad5d3e469e824e44b14e473a6406fb3-46763b95ca722c4f-00","errors":{"$.firstName":["The JSON value could not be converted to System.String. Path: $.firstName | LineNumber: 0 | BytePositionInLine: 52."]}}
The data:
Json:
{"email": "testuser1@referi.io","firstName": "Paltò","TermsPrivacyConfirm": "2023-06-14 TermsAndPrivacy confirmed on 9/26/23","lastName": "User1","password": "SomePw","passwordConfirmation": "SomePw,"mobileNumber": "3406355631","sex": "M","age": "66","type": "User"}
Header:
Content-Type: application/json
Accept: application/json
Accept-Language: it-IT
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6....etc

The LC script goes like this

Code: Select all

...
put kURL into tURL --url to the DB
     put "/api/Authenticate/Register" after tURL
     put jsonExport(tArray) into tServerString --because the fastjsonLib in this case does not work
     put "Content-Type: application/json" & cr & "Accept: application/json" & cr & sHeaderLanguage & cr & "Authorization: Bearer " & sToken into tHeaders
     set the httpHeaders to tHeaders
     post tServerString to url tURL
     put the result into tNetworkErr -- status and/or errors show here
    put it --here the error descibed above
...
This can be a HUGE PROBLEM if I don't fix it right away.
Any idea of what could be wrong?
Thank you for any comment.
Trevix

Re: Failure posting to Azure accented characters content SOLVED

Posted: Tue Sep 26, 2023 2:26 pm
by trevix
Sorry!
I wasn't using UTF-8 correctly on the content.