Logo

Programming-Idioms

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

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)

use utf8;
my $s = 'ネコ';

The utf8 module tells perl that the source code is encoded in UTF-8 and incidentally allows for Unicode literals and identifiers.
const char * s = "ネコ";

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

New implementation...