* standalone url-hexify-string?
@ 2003-04-24 18:55 Kin Cho
2003-04-25 9:43 ` Glenn Morris
0 siblings, 1 reply; 4+ messages in thread
From: Kin Cho @ 2003-04-24 18:55 UTC (permalink / raw)
Anybody has a standalone version of this for gnu emacs?
Thanks.
-kin
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: standalone url-hexify-string?
2003-04-24 18:55 standalone url-hexify-string? Kin Cho
@ 2003-04-25 9:43 ` Glenn Morris
2003-04-25 15:40 ` Kin Cho
0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2003-04-25 9:43 UTC (permalink / raw)
Kin Cho wrote:
> Anybody has a standalone version of this for gnu emacs?
Version on my system is defined as:
(defconst url-unreserved-chars
'(
?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m ?n ?o ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z
?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K ?L ?M ?N ?O ?P ?Q ?R ?S ?T ?U ?V ?W ?X ?Y ?Z
?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9
?$ ?- ?_ ?. ?! ?~ ?* ?' ?\( ?\) ?,)
"A list of characters that are _NOT_ reserve in the URL spec.
This is taken from draft-fielding-url-syntax-02.txt - check your local
internet drafts directory for a copy.")
(defun url-hexify-string (str)
"Escape characters in a string"
(mapconcat
(function
(lambda (char)
(if (not (memq char url-unreserved-chars))
(if (< char 16)
(upcase (format "%%0%x" char))
(upcase (format "%%%x" char)))
(char-to-string char))))
(mule-decode-string str) ""))
(defun mule-decode-string (str)
(and str
(case mule-sysdep-version
((2.4 3.0 xemacs)
(decode-coding-string str mule-retrieval-coding-system))
(2.3
(code-convert-string str *internal* mule-retrieval-coding-system))
;;; ((4.0 4.1)
((4.0 4.1 5.0) ; Emacs 21
(if default-enable-multibyte-characters
(decode-coding-string str mule-retrieval-coding-system)
str))
(otherwise
str))))
I seem to have mule-retrieval-coding-system set to 'euc-japan.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: standalone url-hexify-string?
2003-04-25 9:43 ` Glenn Morris
@ 2003-04-25 15:40 ` Kin Cho
2003-04-25 15:44 ` Glenn Morris
0 siblings, 1 reply; 4+ messages in thread
From: Kin Cho @ 2003-04-25 15:40 UTC (permalink / raw)
Hi,
I tried the function on 21.3, but emacs complainted that
mule-sysdep-version isn't defined. (require 'mule) didn't seem
to help either.
-kin
Glenn Morris <gmorris+news@ast.cam.ac.uk> writes:
> Kin Cho wrote:
>
> > Anybody has a standalone version of this for gnu emacs?
>
> Version on my system is defined as:
>
>
> (defconst url-unreserved-chars
> '(
> ?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m ?n ?o ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z
> ?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K ?L ?M ?N ?O ?P ?Q ?R ?S ?T ?U ?V ?W ?X ?Y ?Z
> ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9
> ?$ ?- ?_ ?. ?! ?~ ?* ?' ?\( ?\) ?,)
> "A list of characters that are _NOT_ reserve in the URL spec.
> This is taken from draft-fielding-url-syntax-02.txt - check your local
> internet drafts directory for a copy.")
>
> (defun url-hexify-string (str)
> "Escape characters in a string"
> (mapconcat
> (function
> (lambda (char)
> (if (not (memq char url-unreserved-chars))
> (if (< char 16)
> (upcase (format "%%0%x" char))
> (upcase (format "%%%x" char)))
> (char-to-string char))))
> (mule-decode-string str) ""))
>
> (defun mule-decode-string (str)
> (and str
> (case mule-sysdep-version
> ((2.4 3.0 xemacs)
> (decode-coding-string str mule-retrieval-coding-system))
> (2.3
> (code-convert-string str *internal* mule-retrieval-coding-system))
> ;;; ((4.0 4.1)
> ((4.0 4.1 5.0) ; Emacs 21
> (if default-enable-multibyte-characters
> (decode-coding-string str mule-retrieval-coding-system)
> str))
> (otherwise
> str))))
>
>
> I seem to have mule-retrieval-coding-system set to 'euc-japan.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: standalone url-hexify-string?
2003-04-25 15:40 ` Kin Cho
@ 2003-04-25 15:44 ` Glenn Morris
0 siblings, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2003-04-25 15:44 UTC (permalink / raw)
Kin Cho wrote:
> I tried the function on 21.3, but emacs complainted that
> mule-sysdep-version isn't defined.
I would have thought it fairly obvious you could remove that bit,
since it appears only in a test for Emacs flavour, and you said you
wanted it for GNU Emacs.
>> (defun mule-decode-string (str)
>> (and str
>> (case mule-sysdep-version
>> ((2.4 3.0 xemacs)
>> (decode-coding-string str mule-retrieval-coding-system))
>> (2.3
>> (code-convert-string str *internal* mule-retrieval-coding-system))
>> ;;; ((4.0 4.1)
>> ((4.0 4.1 5.0) ; Emacs 21
>> (if default-enable-multibyte-characters
>> (decode-coding-string str mule-retrieval-coding-system)
>> str))
>> (otherwise
>> str))))
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-04-25 15:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-24 18:55 standalone url-hexify-string? Kin Cho
2003-04-25 9:43 ` Glenn Morris
2003-04-25 15:40 ` Kin Cho
2003-04-25 15:44 ` Glenn Morris
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.