emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: dmg <dmg@uvic.ca>
To: Sebastian Rose <sebastian_rose@gmx.de>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Re: org-protocol: non-ASCII characters
Date: Fri, 12 Feb 2010 14:23:54 -0800	[thread overview]
Message-ID: <16e9be801002121423y5bdff5bdy2e9e7503f8deb154@mail.gmail.com> (raw)
In-Reply-To: <878wb4rmm6.fsf@gmx.de>

> Basically, it is OK to url-encode each character who's binary
> representation start with 1 (i.e., the value of the character is higher
> than 127). The text to be url-encoded should be UTF-8 ideally.
>
> If you use glib::ustring, it's easy to transform any iso-8859 string to
> utf-8. Each character, whos binary representation start with a 1, has to
> be url-encoded as well as the `%' character [1], but you could as
> url-encode the entire utf-8 string.
>
>

Ok, I think I understand the problem now. I have updated xournal to encode the
filename from its encoding to uft8. that seems to work. See

http://github.com/dmgerman/xournal

For evince, I think I have found a problem in the parsing of the link.
Evince already encodes
the URL, but it does not encode the '/', hence you will get a link like this:

emacsclient 'org-protocol://remember://docview/tmp/00%C3%A1%C3%A9%C3%AD%C3%B3%C3%BA.pdf::1'

the filename is  /tmp/00áéíóú.pdf

But emacs incorrectly stops parsing the link after tmp/

By the way, xournal now supports store-link


--dmg

>
>
>
>
> The function that does the decoding is `org-protocol-unhex-string' which
> in turn uses `org-protocol-unhex-compound'.
>
>
> `man utf-8` shows, how org-protocol tries to decode characters.
>
>
> The JavaScript-Funktion `encodeURIComponent()' returns exactly what we
> need. It recodes a string to utf-8 and then encodes all characters,
> except digits, ASCII letters and these punctuation characters: -_.!~*'()
>
> See ECMA-262 Standard, Section 15.1.3
> (http://bclary.com/2004/11/07/ecma-262.html#a-15.1.3 [2]):
>
>   "The character is first transformed into a sequence of octets using
>    the UTF-8 transformation..."
>
>
> Again, note, that the decoding mechanism relies on the fact, that the
> sequence to decode is url-encoded UTF-8.
>
>
>
>
>
> Example:
>
>  The url-encoded unicode representation of the German umlaut `ö' is
>  `%C3%B6'. Thus
>
>     (org-protocol-unhex-string "%C3%B6")
>
>  gives you "ö".
>
>  In iso-8859-1, the url-encoded representation of the same character `ö' was
>  `%F6'. But
>
>     (org-protocol-unhex-string "%F6")
>
>  gives you "" - the empty string. There is no utf-8 character with this binary
>  representation, since every byte starting with a 1 (i.e. is bigger than 127)
>  starts a multibyte sequence (2 or more bytes).
>
>  But:
>
>     (org-protocol-unhex-string "%2F%3C")
>
>  gives you, as expected,  "/<" which shows, that you could savely
>  url-encode each and every character of a utf-8 encoded string.
>
>
> ==  Footnotes:
>
> [1] The percent character `%' has to be encoded, if followed by
>    [0-9A-Fa-f]{2}, because org-protocol will assume, that a sequence
>    matching "\\(%[0-9a-f][0-9a-f]\\)+" is an encoded character. That
>    said, a `%' has to be url-encoded, since one will hardly ever
>    know for sure, that a `%' is never followed by "[0-9a-f][0-9a-f]".
>
> [2] Get a PDF version of ECMA-262 third edition here:
>    http://www.ecma-international.org/publications/standards/Ecma-262.htm
>
>



-- 
--dmg

---
Daniel M. German
http://turingmachine.org

  reply	other threads:[~2010-02-12 22:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-31  8:39 org-remember support in xournal D M German
2010-01-31  8:45 ` dmg
2010-02-03  9:19 ` Jan Böcker
2010-02-03  9:22   ` dmg
2010-02-04 18:43   ` org-protocol: non-ASCII characters D M German
2010-02-06 13:50     ` Jan Böcker
2010-02-06 14:35       ` Jan Böcker
2010-02-08 11:30         ` Sebastian Rose
2010-02-12 22:23           ` dmg [this message]
2010-02-13 13:22             ` Jan Böcker
2010-02-15  9:41               ` Sebastian Rose

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16e9be801002121423y5bdff5bdy2e9e7503f8deb154@mail.gmail.com \
    --to=dmg@uvic.ca \
    --cc=emacs-orgmode@gnu.org \
    --cc=sebastian_rose@gmx.de \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).