Translating escape sequences

jonathandlynch at gmail.com jonathandlynch at gmail.com
Tue Mar 14 18:40:52 EDT 2017


Does JavaScript have a way to do the translation?

Sent from my iPhone

> On Mar 14, 2017, at 5:26 PM, J. Landman Gay via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> I'm dealing with non-English languages, and JSON data retrieved from a database comes in with unicode escape sequences like this: Eduardo Ba\u00f1uls.
> 
> I need to translate those. I can do it by replacing the "\u" with "0x" and then using numToCodepoint() to get the UTF16 character. But there could be many of these in the same string, so I'm looking for a one-shot command that might just do them all. I don't think we have one.
> 
> The alternative is to loop through all the text, getting an offset for each "\u" and then calculating the number of characters after that to use with numToCodepoint(). But will it always be 4 characters in any language?
> 
> Or is there an easier way?
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list