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 i do the conversion
from utf-8 to ascii, the column length does not change .
Depends. What is "column length" in UTF? Is it the number of UTF-encoded
characters, the number of characters in that encoding, or something else
again? Note that for non-ASCII characters, the first count is smaller
than the second. Also, what are you going to do with those characters?
How will you map U0641 to ASCII?
(Note that a strict interpretation of what you wrote would result in a
trivial implementation: if a UTF-encoded character is not ASCII, it
cannot be converted to ASCII, so the whole conversion fails because of
malformed input - but if all input _is_ ASCII, then it has the same
encoding in UTF-8 as in ASCII in the first place, and no conversion is
necessary. This is not likely to be an acceptable solution ;-) )
Richard