use encode () decode() for utf8 message
example:
1
def cyr2upper(inp,up=True):
if len(inp) > STR_LEN_LIMIT:
inp= inp[:STR_LEN_LIMIT]
try:
inp=inp.decode('utf8')
except UnicodeDecodeError, e:
inp=u'Уточните данные , плс, :)'
symbols = (u"абвгдеёжзийклмнопрстуфхцчшщъыьэюя",
u"АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ")
if up == True:
tr = {ord(a): ord(b) for a, b in zip(*symbols)}
else:
tr = {ord(a): ord(b) for b, a in zip(*symbols)}
return inp.translate(tr).encode('utf8')
2 def fld2lower(x):
return "
".join(x.split()).decode('utf8','ignore').lower().encode('utf8','ignore')
https://habrahabr.ru/post/135913/
пятница, 5 января 2018 г., 22:41:19 UTC+3 пользователь Alexey Zaytsev
написал:
>
>
> <https://lh3.googleusercontent.com/-VwLykH745F4/Wk7AwIz_m7I/AAAAAAAACws/TMJEW_3Yh_YGbOLOe58pnMftPjy_7XDVQCLcBGAs/s1600/w.png>
>
>
>
> <https://lh3.googleusercontent.com/-0GVZd8KbqaU/Wk7BK1-07eI/AAAAAAAACww/M0MrexUzzrUMXUeeHrQ5rGd3Oj9zo4XLQCLcBGAs/s1600/w2.png>
>
>
> <https://lh3.googleusercontent.com/-CfWP8JX428U/Wk7CVrIbtuI/AAAAAAAACw8/KS_ME-Bnoas_E80CYSZODUpD1UTRUQSHgCLcBGAs/s1600/web2py.png>
>
>
>
> <https://lh3.googleusercontent.com/-fYVFLVn_VCY/Wk7ADwto6LI/AAAAAAAACwk/XJ96gZ9JpCQf3nab_XzCLPNiv6xthVQ7QCLcBGAs/s1600/web2py2.png>
>
>
>
> *?*
>
>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.