develooper Front page | perl.beginners | Postings from May 2006

Re: Regular expression for latin1 letters?

Thread Previous | Thread Next
From:
Dr.Ruud
Date:
May 13, 2006 09:15
Subject:
Re: Regular expression for latin1 letters?
Erik schreef:

> This is perl, v5.8.7 built for i686-linux (Gentoo). It seems like it
> is not the file code2html itself it complains about. I can also
> colorize the file itself. It is when I try it with "use encoding
> 'latin1';" on the Ada file that it fails. If I change the letter 'å'
> to something else, code2html works. [...]
>
> with Ada.Text_IO; use Ada.Text_IO;
> procedure Prov is
>    Aål     : Natural := 0;
>    A_      : Natural := 0; --  Illegal
>    A_Boro  : Natural := 0;
>    Go_9r_5 : Natural := 0;
>    9_Are_7 : Natural := 0; --  Illegal
>    AB__CD  : Natural := 0; --  Illegal
>    _P      : Natural := 0; --  Illegal
> begin
>    Put_Line ("Aål =" & Aål'Img);
> end Prov;

Perl expects the input to be (by default) encoded in UTF-8, so you
either need to change the code (add an IO-layer to the input), OR you
should iconv the input:

  iconv -f latin1 -t UTF-8 prov.adb > prov.adb.utf8

After using that, you should not have the "use encoding latin1;"
anymore, because that is only about the Perl-source itself.

-- 
Affijn, Ruud

"Gewoon is een tijger."



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About