weird string literal encoding
by Yu-ji Hosokawa other posts by this author
Jul 1 2009 5:55AM messages near this date
RE: I am really confused how perlapp works
|
Re: weird string literal encoding
Hello,
String literal in perl module file is something weird.
What's wrong?
cp932 is standard code page of Japanese MS Windows.
Both pl and pm file are utf-8 encoded. utf-8 pragma is on.
Any help is very appreciated.
thanks,
C:\Users\yu-ji\work\literal> perl literal.pl
mainæ¥æ¬èª
utf8 flagged
LiteralTestæ¥æ¬èª
C:\Users\yu-ji\work\literal> perlapp --clean --force --nologo literal.pl
C:\Users\yu-ji\work\literal> literal.exe
mainæ¥æ¬èª
utf8 flagged
"\x{0097}" does not map to cp932 at /<C:\Users\yu-ji\work\literal\literal.exe> LiteralTest.pm
line 18.
"\x{009c}" does not map to cp932 at /<C:\Users\yu-ji\work\literal\literal.exe> LiteralTest.pm
line 18.
"\x{009e}" does not map to cp932 at /<C:\Users\yu-ji\work\literal\literal.exe> LiteralTest.pm
line 18.
LiteralTesta\x{0097}\a\x{009c}ï¿¢ea\x{009e}
-- > 8 -- literal.pl
#!perl
# -*- mode: cperl; coding: utf-8-dos; -*-
use 5.010;
use utf8;
use strict;
use warnings;
use Encode;
use Encode::JP;
use LiteralTest;
use open ':encoding(cp932)';
use open ':std';
say __PACKAGE__ . 'æ¥æ¬èª';
LiteralTest::say_literal();
-- > 8 --
-- > 8 -- LiteralTest.pm
# -*- mode: cperl; coding: utf-8-dos; -*-
package LiteralTest;
use 5.010;
use utf8;
use strict;
use warnings;
use Encode;
use Exporter 'import';
our @EXPORT_OK = qw( say_literal );
sub say_literal {
my $nihongo = 'æ¥æ¬èª';
say 'utf8 ' . ( Encode::is_utf8($nihongo) ? 'flagged' : 'not flagged' );
say __PACKAGE__ . $nihongo;
# this shows correct string
#say __PACKAGE__ . decode('utf8', $nihongo);
return;
}
1;
-- > 8 --
C:\Users\yu-ji\work\literal> ver
Microsoft Windows XP [Version 5.1.2600]
C:\Users\yu-ji\work\literal> chcp
ç¾å¨ã®ã³ã¼ã ãã¼ã¸: 932
C:\Users\yu-ji\work\literal> perl -v
This is perl, v5.10.0 built for MSWin32-x86-multi-thread
(with 9 registered patches, see perl -V for more detail)
Copyright 1987-2007, Larry Wall
Binary build 1005 [290470] provided by ActiveState http://www.ActiveState.com
Built May 24 2009 12:17:36
-- snip --
C:\Users\yu-ji\work\literal> perlapp --version
PerlApp 8.0.1 build 289861
Copyright (C) 1998-2009 ActiveState Software Inc. All rights reserved.
-- snip --
_______________________________________________
PDK mailing list
PDK@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Yu-ji Hosokawa
Yu-ji Hosokawa
|