Escape Backslashes (\) in Storage Service

0 votes
Hi, I need to store strings in the storage service that may contain backslashes. If I enter this string "\ud83d\ude0a" manually through AppHQ everything works fine but if I programmatically put those characters into a string and use storageService:updateDocumentByKeyValue then it will drop the backslashes and will show as "ud83dude0a" within AppHQ. If I try to escape the backslash using another backslash then it will double the backslashes like so "\\ud83d\\ude0a". How can I get it to store the single backslashes like this "\ud83d\ude0a"? Maybe I am not using the correct escape character? I am using the Corona SDK. Thanks
asked Feb 23, 2017 in Corona by gsglawson (10 points)
recategorized Feb 23, 2017 by gsglawson

1 Answer

0 votes

Hi Gsglawon,

 

Apologies for getting late back to you. 

Saving backslashes (\) directly through the JSON will not be possible, as application platform by default adds forward slashes ("\/"), double slash ("\\") by removing the backslash. It is recommended to have encoding before adding any value to JSON and decoding back after getting the JSON from the database.

Please use base64 encoding and let me know if you still face any issue while saving/fetching the value from the database.  

Regards,

Himanshu Sharma

answered Feb 27, 2017 by hs00105 (2,005 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...