Skip to content

Tag: unicode

How to iterate over over all Unicode characters?

Is it possible to iterate over all Unicode characters (UTF-8)? Thanks! I’ve tried using: But I’m not sure how to implement it. Answer According to the docs, the parameter passed to String.fromCharCode(a) is converted calling ToUint16 and then said character is returned. You may call it with any nu…

How do I decode escaped unicode javascript code in Python?

I have this string: Which should read “V posledních mÄ›sících se …” so u00ed is í and u011b is Ä›. Any idea how to decode this in Python? It is a javascript code I am parsing in python. I could write my own ad-hoc solution as there are not that many characters that are escaped (there are only …

How can I split a string containing emoji into an array?

I want to take a string of emoji and do something with the individual characters. In JavaScript “😴😄😃⛔🎠🚓🚇”.length == 13 because “â›”” length is 1, the rest are 2. So we can’t do Answer The Grapheme Splitter library by Orlin Georgiev is pretty amazing. Although it hasn’t been u…

String length in bytes in JavaScript

In my JavaScript code I need to compose a message to server in this format: Example: The data may contain unicode characters. I need to send them as UTF-8. I’m looking for the most cross-browser way to calculate the length of the string in bytes in JavaScript. I’ve tried this to compose my payload…

Converting punycode with dash character to Unicode

I need to convert the punycode NIATO-OTABD to nñiñatoñ. I found a text converter in JavaScript the other day, but the punycode conversion doesn’t work if there’s a dash in the middle. Any suggestion to fix the “dash” issue? Answer I took the time to create the punycode below. It it bas…