Perl

Moderators: Jonathan
Number of threads: 1236
Number of posts: 3605

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
How to remove characters from a line Posted by Federal101 on 29 Jun 2005 at 7:00 AM
I have an xml file that has been edited by someone using a French keyboard.

Somehow the file ended up with the characters i>>? (except the question mark is upside down) at the beginning of the file. The characters are invisible, I cannot see them with any text editor that I have tried. They only show up if I diff the file against a US version.

My questions are -

1. Does anyone know what these charaters are and how they got there?
2. Can I use some kind of PERL script to get rid of them?
Report
Re: How to remove characters from a line Posted by Jonathan on 29 Jun 2005 at 3:32 PM
: I have an xml file that has been edited by someone using a French
: keyboard.
:
Ooh la la...c'est affreux!

: Somehow the file ended up with the characters i>>? (except the question
: mark is upside down) at the beginning of the file. The characters are
: invisible, I cannot see them with any text editor that I have tried.
: They only show up if I diff the file against a US version.
:
: My questions are -
:
: 1. Does anyone know what these charaters are and how they got there?
I'm guessing maybe it's something unicode related.

: 2. Can I use some kind of PERL script to get rid of them?
:
Well, you can always remove any non-ASCII characters. Something like...

$the_text =~ s/./ord($1) > 127 ? '' : $1/ge;

May work.

Jonathan

###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.