Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] perl/curses/utf8
- Date: Sun, 07 Aug 2011 02:02:27 +0900
- From: Shmuel Fomberg <owner@example.com>
- Subject: Re: [tlug] perl/curses/utf8
- References: <4E3B4C93.1040907@example.com> <8762mcgwh7.fsf@example.com> <4E3D2E41.5030304@example.com> <4E3D6687.7040300@example.com>
- User-agent: Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20110624 Thunderbird/5.0
Hi s.
On 2011/08/07 1:06, s smith wrote:I would have replaced this line:
use Curses; use Encode qw(encode decode); binmode(STDOUT, ':utf8');
with:my $str = decode 'utf8', 'よろしく、世界';
use utf8; # tells Perl that this source code contains utf8 characters
my $str = 'よろしく、世界';
my $octats = encode 'UTF-16', $str;
now $octats contain a byte-data with UTF-16 encoding.
Of course, you need to know if printw expects UTF-16, UTF-32, Little or Big endiens.
to qoute to documentation:
To find how (UCS-2|UTF-(16|32))(LE|BE)? differ from one another, see Encode::Unicode.
of course, change here to $octats:print $str, "\n"; sleep 5; initscr(); printw("Hello world!\n");printw($str); refresh(); getch(); endwin();
encodings are always a problem, and you always need to keep an eye on in which encoding you get the data, in which encoding it is being kept by the program, and in which encoding the output is expected. get any step wrong, and you will see gibbrish.
good luck.
Shmuel.
- References:
- [tlug] perl/curses/utf8
- From: s smith
- [tlug] perl/curses/utf8
- From: Stephen J. Turnbull
- Re: [tlug] perl/curses/utf8
- From: Shmuel Fomberg
- Re: [tlug] perl/curses/utf8
- From: s smith
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] perl/curses/utf8
- Next by Date: Re: [tlug] perl/curses/utf8
- Previous by thread: Re: [tlug] perl/curses/utf8
- Next by thread: Re: [tlug] perl/curses/utf8
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links