Unicode strings: Difference between revisions

Content added Content deleted
(→‎{{header|Ruby}}: Made more clear that it is easy to use Unicode, even without specific support.)
m (→‎{{header|Go}}: update sub-repo url, plus fix small typo.)
Line 536: Line 536:
This directly allows any Unicode code point in character and string literals.
This directly allows any Unicode code point in character and string literals.
Unicode is also allowed in identifiers like variables and field names, with some restrictions.
Unicode is also allowed in identifiers like variables and field names, with some restrictions.
The <code>string</code> data type represents a read-only sequence of bytes, conventionally but not necessarily represents UTF-8-encoded text.
The <code>string</code> data type represents a read-only sequence of bytes, conventionally but not necessarily representing UTF-8-encoded text.
A number of built-in features interpret <code>string</code>s as UTF-8. For example,
A number of built-in features interpret <code>string</code>s as UTF-8. For example,
<lang go> var i int
<lang go> var i int
Line 576: Line 576:
The standard packages <code>unicode</code>, <code>unicode/utf8</code>, and <code>unicode/utf16</code> have additional functions.
The standard packages <code>unicode</code>, <code>unicode/utf8</code>, and <code>unicode/utf16</code> have additional functions.


Normalization support is available in the [[:Category:Go sub-repositories|sub-repository]] package <code>code.google.com/p/go.text/unicode/norm</code>.
Normalization support is available in the [[:Category:Go sub-repositories|sub-repository]] package <code>golang.org/x/text/unicode/norm</code>.
It contains a number of string manipulation functions that work with the four normalization forms NFC, NFD, NFKC, and NFKD.
It contains a number of string manipulation functions that work with the four normalization forms NFC, NFD, NFKC, and NFKD.
The normalization form type in this package implements the <code>io.Reader</code> and <code>io.WriteCloser</code> interfaces to enable on-the-fly normalization during I/O.
The normalization form type in this package implements the <code>io.Reader</code> and <code>io.WriteCloser</code> interfaces to enable on-the-fly normalization during I/O.