unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: ynyaaa@gmail.com
To: Eli Zaretskii <eliz@gnu.org>
Cc: 23814@debbugs.gnu.org
Subject: bug#23814: 24.5; bug of hz coding-system
Date: Thu, 23 Jun 2016 02:04:18 +0900	[thread overview]
Message-ID: <87k2hhnoj1.fsf@gmail.com> (raw)
In-Reply-To: <877fdiu3xz.fsf@gmail.com>

Eli Zaretskii <eliz@gnu.org> writes:

>> `encode-hz-region' uses `iso-2022-7bit' coding-system internally,
>> replacing it with the coding-system below will work.
>> 
>> (define-coding-system 'iso-2022-cn-gb
>>   "ISO 2022 based 7bit encoding only for Chinese GB2312."
>>   :coding-type 'iso-2022
>>   :mnemonic ?C
>>   :charset-list '(ascii chinese-gb2312)
>>   :designation [(ascii chinese-gb2312) nil nil nil]
>>   :flags '(ascii-at-eol ascii-at-cntl designation 7-bit safe)
>>   )
>
> What advantages does this change have?

`iso-2022-7bit' may encode same character to various strings,
while `iso-2022-cn-gb' encodes same charcter to same string.

(mapcar (lambda (cs) (encode-coding-string
                      (propertize "\x4e00" 'charset cs)
                      'iso-2022-7bit))
        '(chinese-gb2312 japanese-jisx0208 korean-ksc5601
                         chinese-cns11643-1))
=>("\e$AR;\e(B"
   "\e$B0l\e(B"
   "\e$(Cli\e(B"
   "\e$(GD!\e(B")

(mapcar (lambda (cs) (encode-coding-string
                      (propertize "\x4e00" 'charset cs)
                      'iso-2022-cn-gb))
        '(chinese-gb2312 japanese-jisx0208 korean-ksc5601
                         chinese-cns11643-1))
=>("\e$AR;\e(B"
   "\e$AR;\e(B"
   "\e$AR;\e(B"
   "\e$AR;\e(B")

`encode-hz-region' expects `chinese-gb2312' characters are encoded
with "\e$A" sequences, and replaces them to "~{".





  parent reply	other threads:[~2016-06-22 17:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-21 12:22 bug#23814: 24.5; bug of hz coding-system ynyaaa
2016-06-21 12:58 ` Eli Zaretskii
2016-06-22 13:47 ` ynyaaa
2016-06-22 15:28   ` Eli Zaretskii
2016-06-22 17:04 ` ynyaaa [this message]
2016-06-22 17:26   ` Eli Zaretskii
2016-07-09 11:20     ` Eli Zaretskii
2016-07-13 14:12       ` handa
2016-07-23 17:47         ` Eli Zaretskii
2016-07-24  8:21 ` ynyaaa
2016-07-26 15:09   ` handa
2016-07-29  1:05 ` ynyaaa
2016-08-14 11:22   ` handa
2016-08-17  6:33 ` ynyaaa
2016-08-17 14:43   ` handa
2016-08-17 15:28     ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87k2hhnoj1.fsf@gmail.com \
    --to=ynyaaa@gmail.com \
    --cc=23814@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).