Re: [google-appengine] Re: Unicode Support for Python 2.5

2011-07-09 Thread Ross M Karchner
The CSV library docs include an example Unicode CSV reader: http://docs.python.org/library/csv.html#examples On Sat, Jul 9, 2011 at 4:55 PM, Adam Sah wrote: > here's something I've used and worked reasonably well, though not > perfectly. >Suggestions/improvements welcome. > > adam > > > def

Re: [google-appengine] Re: Unicode Support for Python 2.5

2011-07-09 Thread Adam Sah
here's something I've used and worked reasonably well, though not perfectly. Suggestions/improvements welcome. adam def force_to_utf8(text): """ This has been very complicated and painful for us to get this right in Python 2 and App engine. See preso: http://farmdev.com/talks/unicode/ "

Re: [google-appengine] Re: Unicode Support for Python 2.5

2011-07-08 Thread Branko Vukelic
Have you tried unicode(self.request.get('file1'))? There's also force_unicode function in Django. I use a simplified version of it: def force_unicode(s): if not s: return u'' if isinstance(s, unicode): return s try: return unicode(s) except: try:

[google-appengine] Re: Unicode Support for Python 2.5

2011-07-08 Thread prakhil samar
Hey is there anyone GAE expert to resolve this issue I m stucked over this and need to resolve this ASAP. Thanks On Jul 5, 11:34 am, prakhil samar wrote: > Thanks again Julian > > i tried the syntax that you have given, but this does not solves our > problem > > This is the error now i m getting

[google-appengine] Re: Unicode Support for Python 2.5

2011-07-04 Thread prakhil samar
Thanks again Julian i tried the syntax that you have given, but this does not solves our problem This is the error now i m getting when i use csv_file = self.request.get('file1').decode('utf-8') Traceback (most recent call last): File "/base/python_runtime/python_lib/versions/1/google/appengin

[google-appengine] Re: Unicode Support for Python 2.5

2011-07-04 Thread Julian Namaro
Prakhil, Did you resolve this ? You need to do the convertion to unicode before any split or strip, try csv_file = self.request.get('file1').decode('utf-8') on your first line or if it is urlencoded: csv_file = urllib.unquote( self.request.get('file1') ).decode('utf-8') On Jul 1, 3:45 pm, prakhil

[google-appengine] Re: Unicode Support for Python 2.5

2011-07-01 Thread T. Abilo
I had the same issue. You can avoid this issue (which is caused by your unicode wrongly being handed as a str), simply by forcing it to be unicode like u'mystring' for example. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this

[google-appengine] Re: Unicode Support for Python 2.5

2011-06-30 Thread prakhil samar
Hi Julian, Thanks for your information. I am trying to upload a CSV file which contains some special characters (Unicode characters which are not in the ASCII range). The following is the data which the CSV file contains: Name Address City Country

[google-appengine] Re: Unicode Support for Python 2.5

2011-06-30 Thread Julian Namaro
Python2.5 supports unicode and GAE uses it pretty much everywhere already. I'd say you just have to tell the python method opening your CSV file to use utf8 encoding, or use decode('utf-8') on the raw data. On Jun 30, 4:41 pm, prakhil samar wrote: > Hi All > > Please help me out with the UNICODE