Click here to get back home

utf-8 and ascii

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    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
utf-8 and ascii mail2atulmehta 01-25-2005
Posted by mail2atulmehta on January 25, 2005, 3:18 pm
Please log in for more thread options
I have a question. how to generate two files, one in UTF-8, the other
in ASCII with the same column length. So that when you input the data
encoded in utf-8, into a table the clolumn length does not change.
Any help is appreciated..



Posted by Brian McCauley on January 26, 2005, 1:19 pm
Please log in for more thread options


mail2atulmehta@yahoo.com wrote:

> I have a question.

Perhaps then you should ask it.

> how to generate two files, one in UTF-8, the other
> in ASCII

Simply copy the ASCII one. The UTF-8 encoding was designed so that if a
document only uses Unicode code points that are also in ASCII (i.e.
<128) then the ASCII and UTF8 encodings would be binary identical.

> with the same column length.

What is "column length"?

> So that when you input the data
> encoded in utf-8, into a table the clolumn length does not change.

What is "a table"?

> Any help is appreciated..

I suggest that before hitting send on a question you read it and try to
pretend you didn't already know your situation. If, as in this case, it
would be impossible to figure out what you are trying to ask then don't
hit send, instead revise your posting. Repeat as necessary.

Random-shot in the dark...

You are trying to do in-place edits on UTF8 text files that use
fixed-character-width fields. You cannot. To do true in-place edit
the file format must be fixed-byte-width. This, of course, has nothing
to do with Perl.

To have a file that contains fixed-byte-width records and uses UTF8
encoding it's probably best to open the file as a binary file and
explicitly convert using the utf8::encode() and utf8::decode(). (Note:
despite the namespace prefix these are in fact builtins).

For details of how to generally change bits in the middle of files that
don't contain fixed-byte-width records see FAQ.



Similar ThreadsPosted
Problem with DBD::DB2 and UTF8. April 14, 2006, 11:31 am
UTF8 on DBI with Perl April 1, 2007, 11:30 am
What can you use to tie a hash of hashes to either dbm or ascii? December 2, 2007, 12:26 pm
Prettifying ASCII etc text (-> Unicode, TeX etc) January 23, 2005, 2:37 am
replacing characters with their ASCII codes August 20, 2005, 8:50 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap