Strings are also members of the type
String. Strings can be created with the
String constructor. Running
new String('hello') creates an instance of
Finally, String literals are found in the program's source:
var name = 'alex'.
Each integer value in the sequence usually represents a single 16-bit unit of UTF-16 text. However, ECMAScript does not place any restrictions or requirements on the values except that they must be 16-bit unsigned integers.
Ultimately a string is just a sequence of characters. In other words, an array of units of information that correspond to digits, letters, and so on. Characters are represented as byte sequences.
charset=UTF-8. UTF-8 is a system for encoding characters, and is actually "variable width", which means the bytes used to represent an individual character can vary in length.
XMLHTTPRequest should convert the string to the right encoding. Ideally the server should have sent the
Content-Type header set to UTF-8, so the browser will know what to do.
More About Encodings
Even if you're a client-side developer that doesn't care about string encodings, Joel Spolsky's The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets is worth reading because it explains the history behind string encodings. Understanding the history behind what can be a frustrating topic makes it easier to understand.
encodeURIComponent in more detail.