Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Pascal

Idiom #24 Assign to string the japanese word ネコ

Declare a new string s and initialize it with the literal value "ネコ" (which means "cat" in japanese)

{$codepage utf8}
s := "ネコ";

{$codepage utf8}: Explain to the compiler the file (and therefore a string literal) is UTF8 encoded.
You can assign UTF8 literals.
const char * s = "ネコ";

C has no notion of character sets, output depends on locale settings and terminal capabilities.

New implementation...