Jump to content

UNICODE Strings in HTML and Javascript


iwato

Recommended Posts

QUESTION:  Is the following an accurate statement?  If not, please clarify how a unicode string literal differs from say, an ASCII string literal.

Quote

A UNICODE character string is an array-object of single character elements each with its own directional indicator.

Roddy

Untitled-1.html

Edited by iwato
Link to comment
Share on other sites

In Javascript, all strings are internally treated as UTF-16 strings:

http://ecma-international.org/ecma-262/5.1/#sec-8.4

http://speakingjs.com/es5/ch24.html

When a String contains actual textual data, each element is considered to be a single UTF-16 code unit. Whether or not this is the actual storage format of a String, the characters within a String are numbered by their initial code unit element position as though they were represented using UTF-16. All operations on Strings (except as otherwise stated) treat them as sequences of undifferentiated 16-bit unsigned integers; they do not ensure the resulting String is in normalised form, nor do they ensure language-sensitive results.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...