From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "B. T. Raven" Newsgroups: gmane.emacs.help Subject: Re: Encoding multibyte strings Date: Fri, 8 Apr 2016 13:53:01 -0500 Organization: NewsGuy - Unlimited Usenet $23.95 Message-ID: References: <87egagh8zg.fsf@ericabrahamsen.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1464881256 10962 80.91.229.3 (2 Jun 2016 15:27:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Jun 2016 15:27:36 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 02 17:27:35 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b8UWw-0000iA-U7 for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 17:27:31 +0200 Original-Received: from localhost ([::1]:48026 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8UWw-0008T8-4q for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 11:27:30 -0400 Original-Path: usenet.stanford.edu!news.glorb.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!spln!extra.newsguy.com!newsp.newsguy.com!news3 Original-Newsgroups: gnu.emacs.help Original-Lines: 54 Original-NNTP-Posting-Host: pa38a9bea746548a6aacc92ac7214cfd13a9e7bae21d65f0d.newsdawg.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 In-Reply-To: X-Received-Bytes: 2326 X-Received-Body-CRC: 3867658770 Original-Xref: usenet.stanford.edu gnu.emacs.help:217447 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:110174 Archived-At: On 4/8/2016 02:28, Eli Zaretskii wrote: >> From: Eric Abrahamsen >> 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