From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kin Cho Newsgroups: gmane.emacs.help Subject: Re: standalone url-hexify-string? Date: 25 Apr 2003 08:40:10 -0700 Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <7iof2u1t7p.fsf@neoscale.com> References: <7ir87rsp2f.fsf@neoscale.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1051285575 6276 80.91.224.249 (25 Apr 2003 15:46:15 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 25 Apr 2003 15:46:15 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Fri Apr 25 17:46:10 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1995Or-0001cb-00 for ; Fri, 25 Apr 2003 17:46:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 1995OY-0006Ug-00 for gnu-help-gnu-emacs@m.gmane.org; Fri, 25 Apr 2003 11:45:50 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!12.24.46.66!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 56 Original-NNTP-Posting-Host: 12.24.46.66 Original-X-Trace: fu-berlin.de 1051285212 8780679 12.24.46.66 (16 [151019]) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-Xref: shelby.stanford.edu gnu.emacs.help:112331 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:8830 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:8830 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 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.