ISO-8859-2 (Latin-2)

Covers Central and Eastern European languages using Latin script: Polish, Czech, Slovak, Hungarian, Romanian, Croatian, and others.

ISO-8859-2
Fixed (1 byte)
1987

Byte Structure

ISO-8859-2 (Latin-2) uses fixed 1-byte encoding per character. Characters not in this encoding cannot be represented and must be replaced or transliterated.

When to Use ISO-8859-2 (Latin-2)

ISO-8859-2 covers Central and Eastern European languages written in Latin script. You'll encounter it in legacy Polish, Czech, Slovak, Hungarian, or Romanian content. UTF-8 is the correct choice for all new systems targeting these languages.

Sample Characters in ISO-8859-2 (Latin-2)

The table below shows how a selection of characters are represented in ISO-8859-2 (Latin-2). Bytes are shown in hexadecimal. Characters marked "not supported" cannot be encoded in ISO-8859-2 (Latin-2) and would need to be replaced or transliterated when converting from Unicode.

Character Codepoint Name Bytes (Hex) Bytes (Decimal) Supported
A U+0041 LATIN CAPITAL LETTER A 41 65 Yes
a U+0061 LATIN SMALL LETTER A 61 97 Yes
0 U+0030 DIGIT ZERO 30 48 Yes
$ U+0024 DOLLAR SIGN 24 36 Yes
£ U+00A3 POUND SIGN not supported
© U+00A9 COPYRIGHT SIGN not supported
U+20AC EURO SIGN not supported
α U+03B1 GREEK SMALL LETTER ALPHA not supported
А U+0410 CYRILLIC CAPITAL LETTER A not supported
U+4E2D not supported
U+3042 HIRAGANA LETTER A not supported
U+263A WHITE SMILING FACE not supported

Working with ISO-8859-2 (Latin-2) in Code

Every major language has built-in support for encoding conversion. The examples below show how to encode a string to ISO-8859-2 (Latin-2) bytes and decode it back to a Unicode string. Always specify the encoding explicitly — never rely on system defaults, which vary by OS and locale.

# Encode a string to iso-8859-2 bytes
text = "Hello, 世界"
encoded = text.encode("ISO-8859-2")

# Decode bytes back to a string
decoded = encoded.decode("ISO-8859-2")
// Convert to iso-8859-2
$bytes = mb_convert_encoding(
    "Hello, 世界",
    "ISO-8859-2",
    "UTF-8"
);

// Convert back to UTF-8
$text = mb_convert_encoding(
    $bytes,
    "UTF-8",
    "ISO-8859-2"
);
// Encode to ISO-8859-2 bytes
const encoder = new TextEncoder(); // UTF-8
const bytes = encoder.encode("Hello, 世界");

// Decode bytes
const decoder = new TextDecoder("ISO-8859-2");
const text = decoder.decode(bytes);
-- Create a database with ISO-8859-2 (Latin-2)
CREATE DATABASE mydb
  ENCODING 'ISO-8859-2'
  LC_COLLATE 'en_US.UTF-8';

-- Check database encoding
SELECT pg_encoding_to_char(encoding)
FROM pg_database
WHERE datname = current_database();

Compare with Other Encodings

See how ISO-8859-2 (Latin-2) differs from other encodings — which characters each supports and how the byte representations compare.

ISO-8859-2 (Latin-2) FAQ

What is ISO-8859-2 (Latin-2) used for?

ISO-8859-2 (Latin-2) is a character encoding used in specific regional or application contexts. It encodes a defined character set in a fixed-width byte format. For new systems, UTF-8 is the recommended encoding — it supports all Unicode characters and is the universal standard for the web and modern software.

How do I convert ISO-8859-2 (Latin-2) to UTF-8?

In Python: decoded = bytes_data.decode("ISO-8859-2"), then re-encode as UTF-8 with decoded.encode("utf-8"). In PHP: mb_convert_encoding($string, "UTF-8", "ISO-8859-2"). Always verify the output after conversion by checking that the text renders correctly.