oobrien / oomap

OpenOrienteeringMap. Includes the website, tiling scripts, and mapnik stylesheets for OOMap and other raster tile layers.
GNU General Public License v2.0
45 stars 8 forks source link

Cannot download/generate map when special characters are used #60

Closed rugk closed 1 year ago

rugk commented 4 years ago

In German you e.g. have umlauts (äöüÄÖÜ) that are commonly also used in the names of places.

STR

  1. Click a map.
  2. Add abcÄ as the map title at the right.
  3. Generate.

What happens: https://tiler4.oobrien.com/pdf/?style=streeto|paper=0.29700000000000004,0.21000000000000002|scale=5000|centre=6713656,-12598|title=abc%C4|club=undefined|id=5ee4ebac0ba93|start=|crosses=|cps=|controls=

Mod_python error: "PythonHandler renderer::handle"

Traceback (most recent call last):

  File "/usr/local/lib/python2.7/dist-packages/mod_python/apache.py", line 398, in HandlerDispatch
    result = obj(req)

  File "/home/ollie/www/maptiler/renderer.py", line 61, in handle
    req = handlePDF.processRequest(req)

  File "/home/ollie/www/maptiler/handlePDF.py", line 19, in processRequest
    outf = createImage(path, 'pdf')

  File "/home/ollie/www/maptiler/handlePDF.py", line 333, in createImage
    ctx.show_text(text.upper())

Error: input string not valid UTF-8

What should happen: generate correctly, and use proper UTF? Something must be broken…


SIde-note: For public web services, it may not be the best idea to expose such detailed log/stracktrace details, in case of an error. (Or, you could setup some error reporting at the server-side with sentry or so.)

cadnant commented 1 year ago

Fixed in #69 by tweaking Python code to handle utf-8 strings correctly.