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

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

Re: Encoding multibyte strings


From: B. T. Raven
Subject: Re: Encoding multibyte strings
Date: Thu, 02 Jun 2016 15:20:21 -0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1

On 4/8/2016 02:28, Eli Zaretskii wrote:
From: Eric Abrahamsen <address@hidden>
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?

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

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

and

   (quoted-printable-encode-string STRING)

will do the job, IIUC.


(haxe-string-to-x-string "陈冬梅")

evaluated to this:

"\\xe9\\x99\\x88\\xe5\\x86\\xac\\xe6\\xa2\\x85"

that function and a discussion of the problem are here:


http://stackoverflow.com/questions/11085222/translate-unicode-utf-8-codepoint-to-bytes

hth,

Ed





reply via email to

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