Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To save an array in a JavaScript document that contains strings including letters such as á, ö, ő, and í, you can use Unicode escape sequences to represent these characters.

For example, instead of saving the string "árvíztűrő tükörfúrógép" as-is in the array, you would save it like this:

var myArray = ["\u00E1rv\u00EDzt\u0171r\u0151 t\u00FCk\u00F6rf\u00FAr\u00F3g\u00E9p"];

In this example, each accented letter is represented with its corresponding Unicode escape sequence. The prefix "\u" followed by four hexadecimal digits represents a Unicode character in JavaScript.

Alternatively, you can save the strings as UTF-8 encoded values, and decode them when you need to display them. JavaScript has built-in functions for encoding and decoding UTF-8 strings, such as encodeURIComponent() and decodeURIComponent().