Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Unicode problem

by dakkar (Hermit)
on Jun 19, 2005 at 09:55 UTC ( #468087=note: print w/ replies, xml ) Need Help??

in reply to Unicode problem

Works for me, Perl 5.8.2 on Linux. I wrote:

use utf8;

open my $fh,'<:encoding(sjis)','j.sjis.txt';
my $string='言葉';
print index(<$fh>,$string);

saving it as '' as utf-8, and


saving it as 'j.sjis.txt' as shift-jis.

Running it:

$ perl j.sjis.txt

(yes, I used <pre> instead of <code>... but <code> would not let me use character entities, and without the proper characters this answer would be useless)

        dakkar - Mobilis in mobile

Most of my code is tested...

Perl is strongly typed, it just has very few types (Dan)

Comment on Re: Unicode problem
Replies are listed 'Best First'.
Re^2: Unicode problem
by edis (Acolyte) on Jun 20, 2005 at 01:38 UTC
    Sorry, it was my fault, the short lookup string was incorrect (I can't read Japanese, but need to work with it). Everything works fine now.

    Thanks all for the help.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://468087]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2015-11-29 11:01 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (750 votes), past polls