Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

UTF8 vs ANSI

Hey,
Our Openinsight is not UTF8
With php we receive UTF8 JSON from a mobile app.
Finally we were able to send the request in UTF8 to the framework.
Now we find that with the call "SRP_HashTable_Set(MemoryServicesManagers@, KeyID, Value)"
the post-string is put in the hashtable, but if we read the value back immediately, the string is a few characters shorter. (because of utf8 chars?)
Converting the POST-string to ANSI in php corrupts the json.
What are we doing wrong or what is the best way to process UTF8 data in an ansi Openinsight.

Regards Ed

Comments

  • Ed - I have some questions for you:
    • What did you do to finally "send the request in UTF8 to the framework"?
    • Have you tried turning UTF8 on dynamically to see if you can Set and Get the data correctly?
    • Are you able to send me a copy of the UTF8 string for internal testing?
  • Configuring the engine and the php-script took me some hours.
    What do you mean with "turning on UTF8 on dynamically"?
    We run the engine now with "UTFPortNumber"
    The idea is that we can use utf_ansi after we pulled the values from json.
  • Thanks for the attachments. There might be an issue on our end so we are looking into this now.

    What I meant by "turning UTF8 on dynamically" was using the SetUTF8() routine.
  • Just to confirm that I can replicate this when running in UTF8 mode, in SRP_Utilities v2.1.6 and v2.1.12.1 - however v1.6 is ok.

    Work-around seems to be to force ANSI mode around the SET method. Eg
    string = 'kééman\n“Dubbele quote”\n‘Enkele quote’' handle = SRP_Hashtable( 'CREATE') utf8mode = isUTF8() Setutf8( 0) ;// Force single-byte mode SRP_Hashtable( 'SET', handle, 'opmerking', string) Setutf8( utf8mode) ;// restore previous UTF8 mode setting value = SRP_Hashtable( 'GET', handle, 'opmerking') SRP_Hashtable( 'RELEASE', handle)
    Cheers, M@
  • M@ - Thanks for the input. Thanks for confirming the issue and for the workaround.
Sign In or Register to comment.