perldoc > Unicode::String

๐Ÿ“œ Unicode::String - String of Unicode characters (UTF-16BE)

๐Ÿท๏ธ NAME

Unicode::String - String of Unicode characters (UTF-16BE)

๐Ÿš€ Quick Reference

Use CaseCommandDescription
Create UTF-8 stringutf8("string")Construct a Unicode::String from UTF-8 encoded bytes
Create Latin-1 stringlatin1("string")Construct from ISO-8859-1 bytes
Create UTF-16BE stringutf16be("\0s\0t\0r\0i\0n\0g")Construct from big-endian UTF-16
Convert to UTF-8$u->utf8Return UTF-8 encoded version
Convert to UTF-16LE$u->utf16leReturn little-endian UTF-16
Convert to UTF-32BE$u->utf32beReturn big-endian UTF-32
String length$u->lengthNumber of Unicode characters
Concatenate strings$u . $otherOverloaded concatenation operator
Repeat string$u x $countOverloaded repetition operator
Get character code$u->ordOrdinal of first character (supports surrogates)

๐Ÿ“– SYNOPSIS

use Unicode::String qw(utf8 latin1 utf16be);

$u = utf8("string");
$u = latin1("string");
$u = utf16be("\0s\0t\0r\0i\0n\0g");

print $u->utf32be;   # 4 byte characters
print $u->utf16le;   # 2 byte characters + surrogates
print $u->utf8;      # 1-4 byte characters

๐Ÿ“ DESCRIPTION

A "Unicode::String" object represents a sequence of Unicode characters. Methods are provided to convert between various external formats (encodings) and "Unicode::String" objects, and methods are provided for common string manipulations.

The functions utf32be(), utf32le(), utf16be(), utf16le(), utf8(), utf7(), latin1(), uhex(), uchr() can be imported from the "Unicode::String" module and will work as constructors initializing strings of the corresponding encoding.

The "Unicode::String" objects overload various operators, which means that they in most cases can be treated like plain strings.

Internally a "Unicode::String" object is represented by a string of 2 byte numbers in network byte order (big-endian). This representation is not visible by the API provided, but it might be useful to know in order to predict the efficiency of the provided methods.

๐Ÿงฉ Class methods

The following class methods are available:

๐Ÿ”ค Encoding methods

These methods get or set the value of the "Unicode::String" object by passing strings in the corresponding encoding. If a new value is passed as argument it will set the value of the "Unicode::String", and the previous value is returned. If no argument is passed then the current value is returned.

To illustrate the encodings we show how the 2 character sample string of "ยตm" (micro meter) is encoded for each one.

๐Ÿ”ง String Operations

The following methods are available:

๐Ÿ”ง FUNCTIONS

The following functions are provided. None of these are exported by default.

๐Ÿ“š SEE ALSO

ยฉ๏ธ COPYRIGHT

Copyright 1997-2000,2005 Gisle Aas

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Unicode::String
๐Ÿ“œ Unicode::String - String of Unicode characters (UTF-16BE) ๐Ÿท๏ธ NAME ๐Ÿš€ Quick Reference ๐Ÿ“– SYNOPSIS ๐Ÿ“ DESCRIPTION
๐Ÿงฉ Class methods ๐Ÿ”ค Encoding methods ๐Ÿ”ง String Operations
๐Ÿ”ง FUNCTIONS ๐Ÿ“š SEE ALSO ยฉ๏ธ COPYRIGHT

Generated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-08 03:30 @2600:1f28:365:80b0:6814:a048:8015:f4ec
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format

^_top_^