Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Punycode in Curl 8.0
03-29-2012, 05:34 AM, (This post was last modified: 03-29-2012, 09:29 PM by RobertShiplett.)
#1
Punycode in Curl 8.0
The RFC 3492 Punycode (displaying a UNICODE international resource locator as ASCII characters) is explained at http://ja.wikipedia.org/wiki/Punycode OR http://rfc-ref.org/RFC-TEXTS/3492/index.html .

I was very pleased to find encode and decode proc's in the String class of CURL.IO.FILE as

public {idn-hostname-to-unicode hostname:String}:String

and

public {idn-hostname-to-ascii hostname:String}:String

Since we seem to be stuck with the pejorative "puny" or "piu" (for LATIN puteo) or whatever, so perhaps the naming could have been more like puny-to-unicode and unicode-to-puny or at least have the former named

{puny-hostname-to-unicode}

but the important thing is that the methods are there and public.

But note: punycode is for international domain names; for everything to the right of the domain, use

{let aviation:String = {url-encode-string "my-機-directory"} } which should return

"my-%e6%a9%9f-directory"

whereas, e.g.,
http: / / our-機-resources.jp
must become
http: / / xn--our--resources-y454a.jp
which gives us
http: / / xn--our--resources-y454a.jp/my-%e6%a9%9f-directory

until we decide to make that "directory" a subdomain ... but let's not go there. Do we have a browser smart enough to ask you how you want to copy a URL out of your own address bar? My biggest annoyance is ru.wikipedia.org which I often visit while trying to improve my Russian geography ... and whose URL's display unencoded in my browser, but copy encoded. O-vey!

Please note that according to the docs, {idn-hostname-to-ascii some-hostname} is called by {parse-url } when Curl converts the hostname part of a URL to Punycode Ascii . The {url } macro, for example, calls the proc {parse-url }.

Comparing the declaration of {parse-url to that of {abs-url in the Curl docs is instructive.












Robert Shiplett, Curlr
Fredericton NB

Canada
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
Brick Curl macros introduction (part 1) RobertShiplett 4 6,993 04-25-2015, 05:28 PM
Last Post: glennmcgrath
  server-side Curl issue : TocDocument RobertShiplett 3 5,691 02-09-2015, 02:11 PM
Last Post: Sumeraxe
  Curl with HTML widget + CintaNotes RobertShiplett 0 4,444 09-08-2014, 07:42 AM
Last Post: RobertShiplett
  Curl for the new Kodansh kanji books RobertShiplett 0 3,032 09-07-2014, 08:51 PM
Last Post: RobertShiplett
  Curl on Facebook - another page RobertShiplett 0 3,737 02-01-2014, 02:29 AM
Last Post: RobertShiplett
  Curl for CoffeeScript folks RobertShiplett 0 4,758 06-29-2013, 02:52 AM
Last Post: RobertShiplett
  Curl JavaScript bytecodes RobertShiplett 0 4,939 06-19-2013, 10:33 PM
Last Post: RobertShiplett
  jinja2 templates for Curl RobertShiplett 0 4,147 06-14-2013, 08:33 AM
Last Post: RobertShiplett
  Curl and QNX RobertShiplett 0 4,932 04-24-2013, 11:38 PM
Last Post: RobertShiplett
  WikizPad Curl personal wiki RobertShiplett 0 4,115 03-11-2013, 01:09 AM
Last Post: RobertShiplett
Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('452')