Re: Questions about Unicode-aware C programs under Linux

2007-04-17 Thread Ali Majdzadeh
Hello Rich Thanks a lot. That was really a nice clarification of different aspects of the issue, and sorry again if my questions were so elementary. But for me, that was a nice discussion and I learned a lot. Thank you so much. Best Regards Ali On 4/17/07, Rich Felker <[EMAIL PROTECTED]> wrote:

Re: Questions about Unicode-aware C programs under Linux

2007-04-17 Thread Rich Felker
On Tue, Apr 17, 2007 at 03:17:48PM +, Ali Majdzadeh wrote: > Hi Rich > Thanks for your attention. I do use UTF-8 but the files I am dealing with > are encoded using a strange encoding system, I used iconv to convert them > into UTF-8. By the way, another question, if all those stdio.h and > str

Re: Questions about Unicode-aware C programs under Linux

2007-04-17 Thread Rich Felker
On Tue, Apr 17, 2007 at 08:47:19AM +, Ali Majdzadeh wrote: > The program does not print the line read from the file to stdout (some junks > are printed). I also used "cat ./persian.txt | iconv -t utf-8 > in.txt" to > produce a UTF-8 oriented file. If your native encoding is not UTF-8 then of c

Re: Questions about Unicode-aware C programs under Linux

2007-04-17 Thread Ali Majdzadeh
Hi Rich Thanks for your attention. I do use UTF-8 but the files I am dealing with are encoded using a strange encoding system, I used iconv to convert them into UTF-8. By the way, another question, if all those stdio.h and string.hfunctions, work well with UTF-8 strings, as they actually do, what

Re: Questions about Unicode-aware C programs under Linux

2007-04-17 Thread Ali Majdzadeh
Hi Rich Sorry. I managed to solve the problem. You were right. Of course, there are only some minor problems regarding that string literals do not match exactly with those strings read from a file, thus string comparison functions fail to operate. I am going to investigate on it. Thanks a lot Bes

Re: Questions about Unicode-aware C programs under Linux

2007-04-17 Thread Ali Majdzadeh
Hello Rich Sorry, again. I wrote a simple C program using your guidelines but unfortunately it does not work well: The program is as follows: #include #include #include #include #include #include int main( int ar

Re: Questions about Unicode-aware C programs under Linux

2007-04-17 Thread Ali Majdzadeh
Hi Rich Thanks a lot for your response. I am going to test it. Thanks. Best Regards Ali On 4/17/07, Rich Felker <[EMAIL PROTECTED]> wrote: On Tue, Apr 17, 2007 at 10:46:44AM +0430, Ali Majdzadeh wrote: > Hello Rich > Thanks for your response. > About your question, I should say "yes", I need s

Re: Questions about Unicode-aware C programs under Linux

2007-04-16 Thread Rich Felker
On Tue, Apr 17, 2007 at 10:46:44AM +0430, Ali Majdzadeh wrote: > Hello Rich > Thanks for your response. > About your question, I should say "yes", I need some text processing > capabilities. OK. > Do you mean that I should use common stdio functions? (like, fgets(), ...) Yes, they'll work fine.

Re: Questions about Unicode-aware C programs under Linux

2007-04-16 Thread Ali Majdzadeh
Hello Rich Thanks for your response. About your question, I should say "yes", I need some text processing capabilities. Do you mean that I should use common stdio functions? (like, fgets(), ...) And what about UTF-8 strings? Do you mean that these strings should be stored in common char* variables

Re: Questions about Unicode-aware C programs under Linux

2007-04-16 Thread SrinTuar
The best advice you can get is to steer clear of wide characters. You should never need to use any wide character functions. Keep the data in your program internally represented as utf-8. The standard byte-oriented "strlen", "strcpy", "strstr", "printf" etc work fine with utf-8. XML uses utf-8 by

Re: Questions about Unicode-aware C programs under Linux

2007-04-16 Thread Rich Felker
On Mon, Apr 16, 2007 at 11:33:26AM +0330, Ali Majdzadeh wrote: > Hello All > Sorry, if my questions are elementary. As I know, the size of wchar_t data > type (glibc), is compiler and platform dependent. What is the best practice > of writing portable Unicode-aware C programs? Is it a good practice