Amit
Amit

Reputation: 6294

Javascript charCodeAt and fromCharCode not returning the same value

I have a Unicode character that works with a very specific font.

I need to take that character's code, add 8, and convert it back to a string.

Here's python code that works:

char = "񂇁"
char == chr(ord(char)) # True

However, in Javascript, using the matching functions, it does not convert back correctly:

const char = "񂇁";
char == String.fromCharCode("񂇁".charCodeAt(0)) // false

Upvotes: 2

Views: 205

Answers (1)

Related Questions