0

I have created and populated Greek names in a set() and I then pass this set of values to a view function.

When I try to print this set Greek names appear as jibberish. I believe this has somethign to do that Apache mod_wsgi or Bottle doens't start with utf-8 support.

How can I tell Apache/Bottle to use LANG=el_GR.utf-8 so I can display unicode properly because I believe that's the case here?

I looked for AddDefaultCharset utf-8 in httpd.conf but it is already enabled, so I have to ask why the Greek chars appear as jibberish?

shad0w_wa1k3r
  • 12,955
  • 8
  • 67
  • 90
  • You can see the full trace here if you go to my web page `http://superhost.gr/downloads/` and click the file with the Greek letters, its gives an error while the other one the latin one gets displayed properly(although i want to give it to the user as attachment, not view it) – Νικόλαος Βέργος Sep 24 '18 at 14:12
  • Can you include a screenshot of this behavior? Also, maybe your apache config would also be needed. – shad0w_wa1k3r Sep 24 '18 at 16:22
  • You can just click the link on my website to see the unicode error. http://superhost.gr/downloads/ in auth prompt user:nikos, pass=t1abhp2r – Νικόλαος Βέργος Sep 24 '18 at 16:25
  • Ah the Here si the error message, i cant take a screenshot from here: `UnicodeEncodeError('ascii', '/static/files/Î\x92ιογÏ\x81αÏ\x86ικÏ\x8c - Î\x9dίκοÏ\x82.docx', 14, 34, 'ordinal not in range(128)')` – Νικόλαος Βέργος Sep 24 '18 at 16:27
  • Also wanted to say that no that i have tested the lati file for downloaded as well, after adding `download=True` i'm receiveing the error `file not found` whereas if i remove `download=True` it opens in the browser. – Νικόλαος Βέργος Sep 24 '18 at 16:29
  • In that case, I think that is not an apache error, but a `python` error. If you are using python2 then you should replace the filename string by a unicode string, e.g. `u'/static/files/my_greek_file.docx'` instead of `'/static/files/my_greek_file.docx'`. For the `download=True`, you can change it to `download=filename` and try again. But don't forget to make `filename` as `unicode` instead of `str`. See this link for more info https://stackoverflow.com/questions/18034272/python-str-vs-unicode-types – shad0w_wa1k3r Sep 24 '18 at 16:30
  • I'm using Python v3.6.5 – Νικόλαος Βέργος Sep 24 '18 at 16:34
  • Then I'd suggest editing the question and including the complete python error traceback, and also add the `python` tag to it. Or maybe delete this question and start fresh. – shad0w_wa1k3r Sep 24 '18 at 16:36
  • i just anwered with the full error trace. – Νικόλαος Βέργος Sep 24 '18 at 16:40
  • In any case, this should be related - https://stackoverflow.com/questions/2076708/python-os-stat-and-unicode-file-names – shad0w_wa1k3r Sep 24 '18 at 16:49
  • i just read it but in my case i have `[root@superhost public_html]# echo $LANG en_US.UTF-8` But please do answer me in my new thread for this https://stackoverflow.com/questions/52483932/unicodeerror-when-try-to-send-a-file-with-greek-filename – Νικόλαος Βέργος Sep 24 '18 at 16:53

0 Answers0