Click here to get back home

Does unpack() support higher-order Unicode strings for hex conversion?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Does unpack() support higher-order Unicode strings for hex conversion? fhscobey 11-02-2005
Posted by fhscobey on November 2, 2005, 7:27 pm
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Posted by Dr.Ruud on November 3, 2005, 9:11 am
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas

Similar ThreadsPosted
unicode support January 9, 2005, 1:28 am
unicode conversion March 20, 2006, 12:09 am
Re: languages with full unicode support July 4, 2006, 12:05 pm
unicode: equal strings give different results? September 28, 2004, 12:56 am
unpack "B*", 15 November 14, 2008, 7:48 am
pack and unpack ? January 9, 2005, 11:37 am
Extraction of bits using unpack August 17, 2005, 10:08 am
pack /unpack issue November 10, 2005, 7:48 pm
pack, unpack and 64-bit values February 9, 2006, 12:55 pm
replacement of slow unpack June 28, 2006, 9:34 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap