Reputation: 991
In javascript, especially in JSON, we can represent unicode characters with escape sequences or direct unicode string.
How does the two differ? Is there any practical implications or pitfalls in using one over another?
Upvotes: 0
Views: 1899
Reputation: 943595
Escape sequences use ASCII characters so can be represented without having to worry about the encoding that the JS or JSON is transmitted / saved using. They require more bytes per encoded character. They aren't easy for a human to read by looking at source code.
None of the above are true when using a Unicode encoding (such as UTF-8).
Upvotes: 1