Unix Programming - gcc: locale convert error

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > December 2007 > gcc: locale convert error





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author gcc: locale convert error
William Xu

2007-12-12, 7:32 am

I got the following compilation error:

,----
| g++ -c -DFD_SETSIZE=8192 -O2 -I../ipp/include -finput-charsetmake=cp932 vce.cpp -o objREL/vce.o
| In file included from vce.cpp:12:
| ../ipp/include/ipp.h:33:19: error: failure to convert cp932 to UTF-8
`----

Some of the source files are encoded by cp932. ipp is the intel
performance primitives, encoded by ascii. My locale is zh_CN.utf-8.

What is the problem here?

--
William

http://williamxu.net9.org
Bill Marcum

2007-12-12, 7:22 pm

On 2007-12-12, William Xu <william.xwl@gmail.com> wrote:
>
>
> I got the following compilation error:
>
> ,----
>| g++ -c -DFD_SETSIZE=8192 -O2 -I../ipp/include -finput-charsetmake=cp932 vce.cpp -o objREL/vce.o
>| In file included from vce.cpp:12:
>| ../ipp/include/ipp.h:33:19: error: failure to convert cp932 to UTF-8
> `----
>
> Some of the source files are encoded by cp932. ipp is the intel
> performance primitives, encoded by ascii. My locale is zh_CN.utf-8.
>
> What is the problem here?
>

Maybe the file contains characters which aren't valid for that charset.
Have you tried converting the file with another program such as iconv or
recode?
William Xu

2007-12-13, 1:46 am

Bill Marcum <marcumbill@bellsouth.net> writes:

> Maybe the file contains characters which aren't valid for that charset.


Which file are you referring to ? I checked these two files, both are
okay.

,----
| $ file vce.cpp
| vce.cpp: Non-ISO extended-ASCII c program text, with CRLF line terminators
| $ file ../ipp/include/ipp.h
| ../ipp/include/ipp.h: ASCII c program text
`----

> Have you tried converting the file with another program such as iconv or
> recode?


I ran "iconv -f cp932 -t utf-8" on vce.cpp and ipp.h, both could be
converted correctly.

The error says that ipp.h can not be converted from cp932 to utf-8,
which looks awkward to me. ipp.h has only ascii characters, why does gcc
try to convert it anyway? Also, what does ":33:19" mean before "error: " ?

--
William

http://williamxu.net9.org
Ben Bacarisse

2007-12-13, 1:24 pm

William Xu <william.xwl@gmail.com> writes:

> Bill Marcum <marcumbill@bellsouth.net> writes:

<snip>
>
> I ran "iconv -f cp932 -t utf-8" on vce.cpp and ipp.h, both could be
> converted correctly.
>
> The error says that ipp.h can not be converted from cp932 to utf-8,
> which looks awkward to me. ipp.h has only ascii characters, why does gcc
> try to convert it anyway? Also, what does ":33:19" mean before
> "error: " ?


It probably refers to the line and character position of the error. I
say "probably" because you seem to be using a different version of gcc
to me. In you original message, the option is given as
"-finput-charsetmake=cp932" and my gcc has no such option.

gcc probably converts it because conversion is simpler than looking to
see that is does not need to -- looking requires a scan of every
character so you might as well convert on the fly.

--
Ben.
William Xu

2007-12-14, 1:35 am

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> It probably refers to the line and character position of the error. I
> say "probably" because you seem to be using a different version of gcc
> to me.


Hmm, ipp.h is a very short, it has only ascii characters.

> In you original message, the option is given as
> "-finput-charsetmake=cp932" and my gcc has no such option.


I'm sorry, i didn't know how i wrote that extra "make" when posting. The
correct one should be: "-finput-charset=cp932".

The compilation error is still there.

--
William

http://williamxu.net9.org
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com