help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Encoding multibyte strings


From: Eric Abrahamsen
Subject: Re: Encoding multibyte strings
Date: Fri, 08 Apr 2016 15:40:31 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Eric Abrahamsen <eric@ericabrahamsen.net>
>> Date: Fri, 08 Apr 2016 15:09:55 +0800
>> 
>> I'm trying to get from this:
>> 
>> 陈冬梅
>> 
>> to this:
>> 
>> CHARSET=UTF-8;ENCODING=QUOTED-PRINTABLE:=E9=99=88=E5=86=AC=E6=A2=85
>> 
>> Assuming that the original characters were in utf-8, of course. So that
>> 陈 is =E9=99=88, and so on.
>> 
>> I got this string by looking at a Vcard export from the Contacts app on
>> my Android phone. I'm trying to take an Emacs buffer and turn it into a
>> *.vcf card file to import into the same app -- basically I'm trying to
>> reverse-engineer the VCard encoding format so I can create a file to
>> feed to my phone.
>> 
>> I'm 99.9% sure that Emacs already comes with functions that will produce
>> my escaped coded string, but after many adventures with C-h f (during
>> which I learned quite a few unrelated tricks) I haven't found it. Can
>> someone enlighten me as to what the simplest way to do this is?

Hi Eli,

> Not sure what exactly are you looking for.  A wild guess is that

What I'm looking for, I guess, is this:

(mystery-function "陈”) --> "=E9=99=88"

>   (encode-coding-string 'utf-8 STRING)

(encode-coding-string "陈" 'utf-8) --> "\351\231\210"

So maybe what I need is a way to get from "\351\231\210" to "=E9=99=88"?

> and
>
>   (quoted-printable-encode-string STRING)

(quoted-printable-encode-string "陈")

Evalling the above gives me the message "Multibyte character in QP
encoding region"

Thanks,
Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]