Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Your script is written in a non-UTF8 character set (probably latin1). Your data is written in this character set. When you 'use utf8' Perl tries to interpret the data as UTF8. When it hits the 'é' then it complains since this should be a double byte character.

Have a look at the Encode module. Try out a number of scripts and save the output to a file. If you examine the file using a hex editor you will see the double byte representations of non-ascii characters. The documentation for this module is full of references to UTF8. Also look at perluniintro and friends.

This script takes data from STDIN and writes out the UTF8 converted data to a file.

#! /usr/bin/perl use strict; use warnings; use Encode; open UTF8, '>utf8.txt' or die; while (<>) { my $data = encode("utf8", $_); print UTF8 "$data\n"; } close UTF8;

In reply to Re: Non english characters by inman
in thread Non english characters by Ryszard

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2024-03-29 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found