public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Liu Hao <lh_mouse@126.com>
To: Roy Qu <royqh1979@gmail.com>, gcc@gcc.gnu.org
Subject: Re: gcc can't process some utf-8 characters
Date: Thu, 14 Jan 2021 11:27:31 +0800	[thread overview]
Message-ID: <a67fa7f0-8f96-dd59-49c8-be6b20a3d8b3@126.com> (raw)
In-Reply-To: <CAKjWZNXrBreBV+3M1M-GY6NEzccPbepmtUydZ1-71u+_bppUjw@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1272 bytes --]

在 2021/1/14 上午9:47, Roy Qu via Gcc 写道:
> I use "gcc  -finput-charset=utf-8 -fexec-charset=gb2312" to compile utf-8
> encoding source files under  windows. Most of the time it works well, but
> when the source file contains some characters such as "—", gcc will fail
> and the error message is: "[Error] converting to execution character set:
> Illegal byte sequence".
> 
> The attached file is an example. I have tested the file by using iconv to
> convert it from utf-8 to gbk, and iconv works with no complaints.
> 

It looks like this is a bug in iconv. Converting the attached source with `iconv -f utf-8 -t gb2312
testencoding.cpp` gives the same error.

According to the GB2312 code table [1], the EM DASH symbol (U+2014) should map to the double-byte
sequence `A1 AA`. There is no difference among GB2312, GBK and GB18030.

Please consider GB2312 superseded by GBK. The native code page (936) references GBK instead of GB2312.


[1] http://www.khngai.com/chinese/charmap/


> So maybe there's something wrong when gcc is trying to do the encoding
> conversion?
> 
> Some information:
> Toolchain: MinGW-W64-i686, gcc 10.2
> System: Windows 10 Simplified Chinese Home edition ver 2004
> 


-- 
Best regards,
LH_Mouse


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2021-01-14  3:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-14  1:47 Roy Qu
2021-01-14  3:27 ` Liu Hao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a67fa7f0-8f96-dd59-49c8-be6b20a3d8b3@126.com \
    --to=lh_mouse@126.com \
    --cc=gcc@gcc.gnu.org \
    --cc=royqh1979@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).