utf-8 and ascii

M

mail2atulmehta

I am genrating a file(.txt file, which is being opened with notepad),
the file has some data from some tables. The tables has fixed column
length, yet When i open in the notepad the column length changes. For
ex the data in one of the column is Republique Française. now the
field length in the table ( FoxPro database) is suppose 75. Yet when i
open it in the notepad it becomes 74. My problem is that when the
encoding changes from ASCII to UTF-8 , the field length ( or the column
length ) for that value also changes. I know it is happening because no
of bits used in ASCII & UTF-8 are different. Is there soem way I can
keep the column length fixed to 75 only, or is there some programme or
code?
Any help is appreciated
 
R

Richard Tobin

I am genrating a file(.txt file, which is being opened with notepad),
the file has some data from some tables. The tables has fixed column
length, yet When i open in the notepad the column length changes.

This has nothing to do with C. And what you mean by "column length"
is a complete mystery. Do you mean line length? Columns are those
things that go down the page.
Yet when i
open it in the notepad it becomes 74. My problem is that when the
encoding changes from ASCII to UTF-8 , the field length ( or the column
length ) for that value also changes.

It seems that you are counting the number of bytes rather than
characters. Perhaps there is a function for counting characters.

Try a newsgroup for whatever platform you are using, and don't
follow up in this newsgroup.

-- Richard
 
J

Jack Klein

I am genrating a file(.txt file, which is being opened with notepad),
the file has some data from some tables. The tables has fixed column
length, yet When i open in the notepad the column length changes. For
ex the data in one of the column is Republique Française. now the
field length in the table ( FoxPro database) is suppose 75. Yet when i
open it in the notepad it becomes 74. My problem is that when the
encoding changes from ASCII to UTF-8 , the field length ( or the column
length ) for that value also changes. I know it is happening because no
of bits used in ASCII & UTF-8 are different. Is there soem way I can
keep the column length fixed to 75 only, or is there some programme or
code?
Any help is appreciated

The C language doesn't define or specifically support any particular
character set. Not UTF-8, not even ASCII. Nor does it have anything
to say about "notepad", or how it might decide to display things.

You have a compiler/platform specific, and you need to ask about it in
a compiler/platform specific group. There is nothing in the
definition of the C language that can help.

Try
 
L

Lawrence Kirby

I am genrating a file(.txt file, which is being opened with notepad),
the file has some data from some tables. The tables has fixed column
length, yet When i open in the notepad the column length changes. For
ex the data in one of the column is Republique Française. now the
field length in the table ( FoxPro database) is suppose 75.

Your appear to have a problem relating to FoxPro and/or Notepad.
Yet when i
open it in the notepad it becomes 74.

So look at the data with some other tool, such as some sort of hex dump
and see whether there is a problem with how the data is being written out
by Foxpro or how Notepad is reading it.
My problem is that when the
encoding changes from ASCII to UTF-8 , the field length ( or the column
length ) for that value also changes.I know it is happening because no
of bits used in ASCII & UTF-8 are different.

What encoding, where? Note that pure ASCII text is encoded the same way in
UTF-8. Given the French connection you mention above perhaps the text
isn't pure ASCII.
Is there soem way I can
keep the column length fixed to 75 only,

You'll have to ask the Foxpro and/or Notepad experts about that i.e. post
in the appropriate newsgroup.
or is there some programme or code?

Maybe, but first you need to determine what is causing the problem. Please
note that comp.lang.c is for discussing the C programming language, not
usage issues of Foxpro and Notepad, or even general UTF-8 character
encoding issues.

Lawrence
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

utf-8 to ascii 5
UTF-8 and strings 44
UTF-8 read & print? 6
US-ASCII to UTF-8 2
UTF-8 1
utf-8 and ctypes 5
CSV readers and UTF-8 files 2
MeCab UTF-8 Decoding Problem 6

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top