Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: ignore UTF codes

by kettle (Beadle)
on Mar 16, 2006 at 04:35 UTC ( [id://537044]=note: print w/replies, xml ) Need Help??


in reply to ignore UTF codes

could it be that my text document is DOS formatted? Perl does not seem to be recognizing the UTF codes at all. I cannot do anything to access them, and when I try to manipulate the line, most of the time I get a line like this

Malformed UTF-8 character (overflow at 0xa0c75a60, byte 0x70, after start byte 0xbf) in uc at ./qNa.pl line 15, <IN> line 25. joe

Replies are listed 'Best First'.
Re^2: ignore UTF codes
by zer (Deacon) on Mar 16, 2006 at 04:37 UTC
    you can access utf code... it depends on your situation... usualy from my experiances dos has been straight ascii... Let me see if i can find something for you

    -------------------------------------------
    Ok there is a utf8::is_utf8() module. Itll find out if your character is utf8. so for example

    $a=chr(0x74); print utf8::is_utf8($a)?"yes":"no"; $a=chr(0x470); print utf8::is_utf8($a)?"yes":"no";
    the output is "noyes" ...

    if you can provide some more code i can give you a more specific answer

      thanks! i also tried to convert from dos2unix, but that did nothing to solve my problem :-(
      In the example line I gave before:

      Canciones\251STAMPID\253\277De quien es la cancion "STAND BY ME"*4 the cause

      I would simply like to delete the '\253' from the line (there is more that I will eventually want to do, but if I could complete this simple action, the rest ought to be a piece of cake. my first attempt at this was:

      $_ = s/\\253//g;

      This failed miserably. The problem is that the '\253' is being treated as a single character (i.e., if I try to highlight just one digit, it highlights the entire 4 digit string) I'm trying to write a c++ program to convert the codes to ASCII.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-25 23:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found