[tex-live] Lua module 'socket.url' loading problem with getmap

Josef Kleber imap.jk at kleberj.de
Sat Jun 30 17:07:58 CEST 2018


Dear Akira,

Am 30.06.2018 um 15:31 schrieb Akira Kakuto:
> Dear Josef,
> 
>> I get a different error message, but I can reproduce the problem with
>> fully updated TL2018.
> 
> An attached getmaptest.zip
> contains
> 
> runscript.tlu
> 
> lua/ltn12.lua
> lua/mime.lua
> lua/socket.lua
> 
> lua/socket/ftp.lua
> lua/socket/headers.lua
> lua/socket/http.lua
> lua/socket/smtp.lua
> lua/socket/tp.lua
> lua/socket/url.lua
> 
> After saving the original runscript.tlu,
> please copy all these 10 files in bin/win32,
> by preserving the directory structure.
> 
> Here
> getmapdl -m gm -l 'Stachus, Munchen' -o muc -i png
> works with the above.
> 

this worked unfortunaly only by accident, because there's no need for
url escaping or at least the comma and the space does not hurt.

If I use München with german u umlaut, I don't get an error message but
socket.url seems still not loaded. There seems to be a png download but
its size is less than 1kb and corrupt.

$ getmapdl -m gm -l 'Stachus, München' -i png -o muc

[snip]

getmapdl.lua:
url =
http://maps.googleapis.com/maps/api/staticmap?center=Stachus%2c%20M%fcnchen&size=600x400&zoom=17&markers=size:mid|color:blue|label:1|Stachus%2c%20M%fcnchen&maptype=roadmap&scale=1&format=png&sensor=false
url length = 203 bytes

If you copy the produced url into a browser, then Google servers respond
with "The Google Maps Platform server rejected your request. Invalid
request. One of the input parameters contains a non-UTF-8 string."

If I use standard lua (from Cygwin) I get a valid url and a correct png:

$ lua /cygdrive/c/texlive/2018/texmf-dist/scripts/getmap/getmapdl.lua -m
gm -l 'Stachus, München' -i png -o muc

[snip]

getmapdl.lua:
url =
http://maps.googleapis.com/maps/api/staticmap?center=Stachus%2c%20M%c3%bcnchen&size=600x400&zoom=17&markers=size:mid|color:blue|label:1|Stachus%2c%20M%c3%bcnchen&maptype=roadmap&scale=1&format=png&sensor=false
url length = 209 bytes
output = muc.png

So my conclusion is that the error message is gone but socket.url is
still not loaded. See difference in url length of 6 byte.

I have as workaround copied the code of socket.url.escape into a local
function in an adapted getmapdl.lua
(https://a237234.jupiter.1blu.de/data/public/330a5d.php). This version
works as expected, therefore my conclusion that socket.url is still missing.

...

Surprisingly, I just learned that it works if called from getmap.sty!
utf8 as well as latin1/ansi!

\documentclass{article}
%\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage[overwrite=true]{getmap}
\begin{document}
\getmap[mode=gm]{Bergheimer Straße 110A, 69115 Heidelberg, Germany}
\includegraphics[width=10cm]{getmap}

\getmap[file=berlin, mode=gm]{Brandenburger Tor, Berlin}
\includegraphics[width=10cm]{berlin}

%\getmap[file=muc, mode=gm]{Stachus, Muenchen}
\getmap[file=muc, mode=gm]{Stachus, München}
\includegraphics[width=10cm]{muc}
\end{document}

Run pdflatex -shell-escape file.tex

Maybe you can add an example with japanese "letters" in utf-8. Should
work with Google.

So my new conclusion is that socket.url is in but there's maybe still an
encoding problem if called from command line, but this also worked 2
years ago. ???

As long as it works with the package, that's ok for me. ;-)

Josef


More information about the tex-live mailing list