apache - Python 3.4 causes UnicodeEncodeError on Apache2 server (Mac) but works fine in command line -
i'm trying python 3.4 cgi script , apache output 'ü' character in browser (same problem occurs other unicode character, matter). python 3.4 cgi script causes unicodeencodeerror in apache while similar python 2.7 code works fine on same server. both scripts 3.4 , 2.7 work fine command line. this error while running python 3.4 script: unicodeencodeerror: 'ascii' codec can't encode character '\xfc' in position 23: ordinal not in range(128) here's code causes error: #!/usr/local/bin/python3 # -*- coding: utf-8 -*- print ("content-type: text/html; charset=utf-8\n\n") print ("""\ <html> <head> <meta charset="utf-8"> </head> <body> """) print ("u umlaut (python 3.4): ü<br>") print ("""\ </body> </html> """) the python 2.7 script below on same server displays ü , other unicode characters correctly: (so it&