From mboxrd@z Thu Jan 1 00:00:00 1970 From: "numbchild@gmail.com" Subject: unhex org-link for shell command Date: Wed, 17 Jan 2018 17:55:22 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c1c1b4051e4c80562f5dabb" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebkRs-0007AA-4n for emacs-orgmode@gnu.org; Wed, 17 Jan 2018 04:56:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebkRm-0000oR-9A for emacs-orgmode@gnu.org; Wed, 17 Jan 2018 04:56:00 -0500 Received: from mail-ot0-x233.google.com ([2607:f8b0:4003:c0f::233]:37592) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebkRm-0000o7-4E for emacs-orgmode@gnu.org; Wed, 17 Jan 2018 04:55:54 -0500 Received: by mail-ot0-x233.google.com with SMTP id a24so16302713otd.4 for ; Wed, 17 Jan 2018 01:55:53 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org-mode --94eb2c1c1b4051e4c80562f5dabb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I'm developing an Emacs package https://github.com/stardiviner/org-send-ebook . I found Org-mode hex spaces in filename with "%20", So I reverse this with function `(url-unhex-string (org-element-property :path (org-element-context)))`. But this only works for English filename. If it is Chinese filename. this will caused error. Is there Org-mode built-in function which return the file path with out hexing spaces '%20' ? Or Does Emacs has functions can unhex '%20' correctly on Chinese? Here is the test case: org link: [[file:Data/Books/%E6%80%8E%E6%A0%B7%E8%AF%BB%E4%B9%A6.mobi][=E6=80=8E=E6= =A0=B7=E8=AF=BB=E4=B9=A6 (mobi)]] And there is the result of `(org-element-property :path (org-element-context))`: "Data/Books/%E6%80%8E%E6%A0%B7%E8%AF%BB%E4%B9%A6.mobi" [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ --94eb2c1c1b4051e4c80562f5dabb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'm developing an Emacs package https://github.com/stardiviner/org-send= -ebook .
I found Org-mode hex spaces in filename with "%20&qu= ot;, So I reverse this with function `(url-unhex-string (org-element-proper= ty :path (org-element-context)))`. But this only works for English filename= . If it is Chinese filename. this will caused error.

Is ther= e Org-mode built-in function which return the file path with out hexing spa= ces '%20' ?
Or Does Emacs has functions can unhex '%20'= ; correctly on Chinese?

Here is the test case:
org li= nk:
[[file:Data/Books/%E6%80%8E%E6%A0%B7%E8%AF%BB%E4%B9%A6.mobi][= =E6=80=8E=E6=A0=B7=E8=AF=BB=E4=B9=A6 (mobi)]]
And there is the result = of `(org-element-property :path (org-element-context))`:
"Data/Bo= oks/%E6%80%8E%E6%A0%B7%E8%AF%BB%E4%B9%A6.mobi"

[stardiviner]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 <Hack this world!>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 GPG key ID= : 47C32433
IRC(freeenode): stardiviner =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 Twitter:=C2=A0 @numbchild
Key fingerprint =3D 9BAA 92BC CDDD B9EF= 3B36=C2=A0 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/
<= /div>
--94eb2c1c1b4051e4c80562f5dabb-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: unhex org-link for shell command Date: Wed, 17 Jan 2018 22:40:51 +0100 Message-ID: <87a7xcrwnw.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebvS6-0001Uk-Eh for emacs-orgmode@gnu.org; Wed, 17 Jan 2018 16:40:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebvS2-0005k0-2t for emacs-orgmode@gnu.org; Wed, 17 Jan 2018 16:40:58 -0500 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:55055) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ebvS1-0005jP-Sb for emacs-orgmode@gnu.org; Wed, 17 Jan 2018 16:40:54 -0500 In-Reply-To: (numbchild@gmail.com's message of "Wed, 17 Jan 2018 17:55:22 +0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "numbchild@gmail.com" Cc: Org-mode Hello, "numbchild@gmail.com" writes: > I'm developing an Emacs package > https://github.com/stardiviner/org-send-ebook . > I found Org-mode hex spaces in filename with "%20", So I reverse this with > function `(url-unhex-string (org-element-property :path > (org-element-context)))`. But this only works for English filename. If it > is Chinese filename. this will caused error. You can use `org-link-unescape'. Regards, -- Nicolas Goaziou From mboxrd@z Thu Jan 1 00:00:00 1970 From: "numbchild@gmail.com" Subject: Re: unhex org-link for shell command Date: Thu, 18 Jan 2018 10:03:52 +0800 Message-ID: References: <87a7xcrwnw.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="94eb2c1c1b40f2d6a105630361b3" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebzZ3-0004FU-1P for emacs-orgmode@gnu.org; Wed, 17 Jan 2018 21:04:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebzZ1-0005h5-Vp for emacs-orgmode@gnu.org; Wed, 17 Jan 2018 21:04:25 -0500 Received: from mail-ot0-x235.google.com ([2607:f8b0:4003:c0f::235]:33895) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebzZ1-0005gs-Pg for emacs-orgmode@gnu.org; Wed, 17 Jan 2018 21:04:23 -0500 Received: by mail-ot0-x235.google.com with SMTP id p16so18711219otf.1 for ; Wed, 17 Jan 2018 18:04:23 -0800 (PST) In-Reply-To: <87a7xcrwnw.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: Org-mode --94eb2c1c1b40f2d6a105630361b3 Content-Type: text/plain; charset="UTF-8" Thanks very much. [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Thu, Jan 18, 2018 at 5:40 AM, Nicolas Goaziou wrote: > Hello, > > "numbchild@gmail.com" writes: > > > I'm developing an Emacs package > > https://github.com/stardiviner/org-send-ebook . > > I found Org-mode hex spaces in filename with "%20", So I reverse this > with > > function `(url-unhex-string (org-element-property :path > > (org-element-context)))`. But this only works for English filename. If it > > is Chinese filename. this will caused error. > > You can use `org-link-unescape'. > > Regards, > > -- > Nicolas Goaziou > --94eb2c1c1b40f2d6a105630361b3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks very much.

[stardiviner]=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Hack this world!= >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 GPG key ID: 47C32433
IRC(freeenode): = stardiviner =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Twitter:=C2=A0 @numbchi= ld
Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36=C2=A0 CB99 B8C4 B8E5 47C= 3 2433
Blog: http://stardiviner.github.io/

On Thu, Jan 18, 2018 at 5:40 AM, Nicolas Goa= ziou <mail@nicolasgoaziou.fr> wrote:
Hello,

"numbchild@gmail.com" = <numbchild@gmail.com> writ= es:

> I'm developing an Emacs package
> https://github.com/stardiviner/org-send-ebook= .
> I found Org-mode hex spaces in filename with "%20", So I rev= erse this with
> function `(url-unhex-string (org-element-property :path
> (org-element-context)))`. But this only works for English filename. If= it
> is Chinese filename. this will caused error.

You can use `org-link-unescape'.

Regards,

--
Nicolas Goaziou

--94eb2c1c1b40f2d6a105630361b3--