4/6 I got a url that looks like
http://www.whatever.com/祢.mp3
How should I encode this link so that every browser (including lynx)
can understand it?
\_ If your file really is named 祢, you should encode it as
http://www.whatever.com/%26%2331074%3B.mp3 (replace each weird
character with a percent sign and the character's ASCII value in
hex). If your file is actually named with a Chinese character,
it's more complicated. With a modern server and browser, you can
just put a Chinese character right into the URL. If you have a
modern server but you want to support old or non-Chinese browsers,
convert the characters to UTF-8, break them into bytes, and
percent-encode each byte -- for your example, that would become
http://www.whatever.com/%E7%A5%A2.mp3 If you have an old server,
do the same thing, but instead of UTF-8, use whatever encoding
the server uses for filenames (probably Big5 or GB). --mconst
\_ Yes, that's what I am looking for.
\_ Yes, that's what I am looking for. Can you show me code example
of your conversion?
\_ Is the 祢 literal? That is, is that the file name on disk,
or is that already an HTML entity? If it's an HTML entity,
every browser should recognize it, although if you try to type
it in on the command line, the shell will freak out. That's
not a lynx issue and there's nothing you can do about it. -tom
\- er why should the shell "freak out" if you quote it properly?
lynx -dump http://www.whatever.com/\&\#31074\;.mp3 > /dev/null
\_ Obviously you can quote it in the shell, but it can't be
both quoted for the shell and a valid URL at the same
time. -tom
\_ single quotes are your friend. |