Which OS are you using? Here's what I get on Ubuntu 12.04:

$ python web2py.py -S welcome
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2013
Version 2.6.0-development+timestamp.2013.08.15.17.14.24
Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(
pg8000), MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), IMAP(
imaplib)
WARNING:web2py:import IPython error; use default python shell
Python 2.7.3 (default, Apr 10 2013, 06:20:15) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> print "áéíóú"
áéíóú

But on Windows 7, I get:

>>> print "áéíóú"
áéíóú

Note, the web2py shell uses 
code.interact()<http://docs.python.org/2/library/code.html#code.interact>, 
so that may be the cause of differences in behavior from the standard shell.

Anthony

On Friday, September 27, 2013 12:23:27 PM UTC-4, viniciusban wrote:
>
> Hey all. 
>
> I'm facing a strange problem concerning special characters. 
>
> Using web2py shell, through command line (linux shell), I do this: 
>
> # ----------------  start 
> $ python web2py.py -S welcome 
> web2py Web Framework 
> Created by Massimo Di Pierro, Copyright 2007-2013 
> Version 2.6.4-stable+timestamp.2013.09.22.01.43.37 
> Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
> PostgreSQL(pg8000), IMAP(imaplib) 
> WARNING:web2py:import IPython error; use default python shell 
> Python 2.7.3 (default, Apr 10 2013, 06:20:15) 
> [GCC 4.6.3] on linux2 
> Type "help", "copyright", "credits" or "license" for more information. 
> (InteractiveConsole) 
> >>> print "áéíóú"   # note the strange chars! 
> áéíóú 
> >>> from unicodedata import normalize 
> >>> normalize("NFKD", "áéuíóú".decode("utf-8")).encode("ASCII", "ignore") 
> # again! 
> 'AAuAA3Ao' 
> # ----------------  end 
>
> Note the noisy characters on the last line. 
>
>
> Then, at the same machine, I enter into the naked Python shell and: 
> # ----------------  start 
> $ python 
> Python 2.7.3 (default, Apr 10 2013, 06:20:15) 
> [GCC 4.6.3] on linux2 
> Type "help", "copyright", "credits" or "license" for more information. 
> >>> print "áéíóú" # looks ok 
> áéíóú 
> >>> from unicodedata import normalize 
> >>> normalize("NFKD", "áéuíóú".decode("utf-8")).encode("ASCII", "ignore") 
> # ok again. 
> 'aeiou' 
> # ----------------  end 
>
> Everything works fine. 
>
> The same code. 
>
> I found this problem because I'm working to strip special characters 
> off of names, with unicodedata.normalize(). 
>
> If it wan't strange enough, the unicodedata.normalize() works fine 
> from web environment, throug app admin. There the normalization works 
> as expected (the same way as the standard naked Python shell). 
>
> What could be the root of this situation? 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to