all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "B. T. Raven" <btraven@nihilo.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Encoding multibyte strings
Date: Fri, 8 Apr 2016 13:53:01 -0500	[thread overview]
Message-ID: <ne8un302iqb@news3.newsguy.com> (raw)
In-Reply-To: <mailman.31.1460100539.7477.help-gnu-emacs@gnu.org>

On 4/8/2016 02:28, Eli Zaretskii wrote:
>> 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?
>
> 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





      parent reply	other threads:[~2016-04-08 18:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-08  7:09 Encoding multibyte strings Eric Abrahamsen
2016-04-08  7:28 ` Eli Zaretskii
2016-04-08  7:40   ` Eric Abrahamsen
2016-04-08  7:48     ` Eli Zaretskii
2016-04-08  8:02       ` Eric Abrahamsen
     [not found] ` <mailman.31.1460100539.7477.help-gnu-emacs@gnu.org>
2016-04-08 18:53   ` B. T. Raven [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=ne8un302iqb@news3.newsguy.com \
    --to=btraven@nihilo.net \
    --cc=help-gnu-emacs@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.