in windiws
print s 
rise error

127.0.0.1.2015-06-06.15-31-01.ad5a7b20-4ee7-4c91-a9df-8e015fd609e0
<type 'exceptions.UnicodeEncodeError'> 'charmap' codec can't encode 
characters in position 0-4: character maps to <undefined>Версияweb2py™Version 
2.9.12-stable+timestamp.2015.01.17.06.11.03PythonPython 2.7.6: 
C:\Python27\python.exe (prefix: C:\Python27)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.

Traceback (most recent call last):
  File "C:\web2py-m\gluon\restricted.py", line 224, in restricted
    exec ccode in environment
  File "C:/web2py-m/applications/ipay/controllers/edealers.py" 
<http://127.0.0.1:8000/admin/edit/ipay/controllers/edealers.py>, line 280, in 
<module>
  File "C:\web2py-m\gluon\globals.py", line 393, in <lambda>
    self._caller = lambda f: f()
  File "C:/web2py-m/applications/ipay/controllers/edealers.py" 
<http://127.0.0.1:8000/admin/edit/ipay/controllers/edealers.py>, line 139, in 
list_incoms
    mess = serv_to_buy.proc_history(db, only_list, ed_acc, from_dt)
  File "applications\ipay\modules\serv_to_buy.py", line 283, in proc_history
    print rec.get('title')
  File "C:\Python27\lib\encodings\cp437.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-4: 
character maps to <undefined>

суббота, 6 июня 2015 г., 11:48:30 UTC+3 пользователь dbdeveloper написал:
>
>  Hi, Dmitry
>
> You've got a unicode string. So you need to convert it to a str type with 
> utf-8 sequence in it. Use encode() method of unicode type:
>
> >>> s = u'\u041f\u0435\u0440\u0435\u043d\u043e\u0441 
> \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0441\u043e 
> \u0441\u0447\u0435\u0442\u0430 \u0432 
> \u043e\u0447\u0435\u0440\u0435\u0434\u044c'
> >>> print s
> Перенос средств со счета в очередь
> >>> type(s)
> <type 'unicode'>
> >>> s.encode('utf-8')
> '\xd0\x9f\xd0\xb5\xd1\x80\xd0\xb5\xd0\xbd\xd0\xbe\xd1\x81 
> \xd1\x81\xd1\x80\xd0\xb5\xd0\xb4\xd1\x81\xd1\x82\xd0\xb2 \xd1\x81\xd0\xbe 
> \xd1\x81\xd1\x87\xd0\xb5\xd1\x82\xd0\xb0 \xd0\xb2 
> \xd0\xbe\xd1\x87\xd0\xb5\xd1\x80\xd0\xb5\xd0\xb4\xd1\x8c'
> >>> s1=s.encode('utf-8')
> >>> type(s1)
> <type 'str'>
> >>> print s1
> Перенос средств со счета в очередь
>
> Now you can use s1 in your returrn clause.
>
>
> Vlad
> Chernivtsi, Ukraine
>
> У сб, 2015-06-06 у 01:22 -0700, Dmitry Ermolaev пише:
>
> u'\u041f\u0435\u0440\u0435\u043d\u043e\u0441 
> \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0441\u043e 
> \u0441\u0447\u0435\u0442\u0430 \u0432 
> \u043e\u0447\u0435\u0440\u0435\u0434\u044c'
>
>
> 

-- 
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/d/optout.

Reply via email to