Jump to content

[SOLVED]Python Utf8


Carl A.

Recommended Posts

I wanted to start using Helio using Python/Django. However, whatever I do I'll get a 500 error. So, I tried to make to simple cgi scripts with python, one using us-ascii and another in utf8. The former works, the latter gives me again a 500 error.

 

Am I missing something?

 

There is a high probability that I will use UTF-8 later in the project so I don't want to use ascii.

(.. also: I don't know where the error log is located :-()

 

agon.

Link to comment
Share on other sites

ANSI (actually saved as us-ascii), which prints the hello-world message:

#!/usr/bin/python

print "Content-Type: text/plain\n\n"

print "Hello World: ANSI"

and UTF-8 (which gives a 500 Error):



#!/usr/bin/python

print "Content-Type: text/plain\n\n"

print "Hello World: UTF-8"

.. nothing too fancy.

 

I rechecked just to be sure:

The permission on for both files, which are in the same directory, is 755.

Link to comment
Share on other sites

Thank you so far.

 

The django app is developed on Ubuntu, so I assume there it's unixy.

The two scripts were actually windowsy, but they are both. I changed the utf8 one to Unix-line-endings, but the problem remains.

 

... after I changed the encoding of the UTF8-file to ansi, it works.

 

---------------- Later this evening ------

Ha, got it:

I had to remove the BOM from the UTF8 file.

 

Now, if this is also the problem with my django application (currently merely a hello-world) then it would be rather annoying to have the BOM removed from every file that is created from python/django. Well, I will look into this during the weekend.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...