Hi!
If you haven't solved this problem yet
try something like this:
def MSACCESS_adapt(s,f):
for it in f.items():
if type(it[1])==str:
f[it[0]]=it[1].decode('utf8').encode('1251')
elif type(it[1])==datetime.datetime:
f[it[0]]=it[1].strftime('%Y-%m-%d %H:%M:%S')
mdb.table_cp1251._before_update.append(MSACCESS_adapt)
On Saturday, August 9, 2014 at 4:03:16 AM UTC+2, Massimo Di Pierro wrote:
>
> OK. please open a ticket and I will try reproduce it tonight.
>
> On Wednesday, 6 August 2014 21:31:12 UTC-5, Алексей Котряхов wrote:
>>
>> Hello
>> I double checked. In layout.html <meta charset="utf-8" />
>>
>>
>> четверг, 7 августа 2014 г., 7:11:04 UTC+11 пользователь Massimo Di Pierro
>> написал:
>>>
>>> Before we look into something else can you check the encoding declared
>>> in your layout.html? It should be utf8
>>>
>>>
>>> On Wednesday, 6 August 2014 02:09:26 UTC-5, Алексей Котряхов wrote:
>>>>
>>>> Hello
>>>> The first problem was solved by changing URI from mssql to mssql2
>>>> Now DB connection as following and no problem with viewing and saving
>>>> strings with cyrillic letters.
>>>>
>>>> dbsol = DAL
>>>> <http://127.0.0.1:8000/examples/global/vars/DAL>('mssql2://user:password@w2ptkts/SacuraOnline',
>>>> db_codec = 'cp1251', migrate_enabled = False)
>>>>
>>>> But the second problem (save the profile with the Cyrillic alphabet)
>>>> still exist.
>>>> I don't understand why this is happening?
>>>>
>>>> But the second problem (save the profile with the Cyrillic alphabet)
>>>> still exist.
>>>> I do not understand why this is happening?
>>>> Data from the same table, the same connection.
>>>> Maybe in the implementation of saving Profile skipped recoding code
>>>> pages?
>>>>
>>>> понедельник, 4 августа 2014 г., 14:45:50 UTC+11 пользователь Алексей
>>>> Котряхов написал:
>>>>>
>>>>>
>>>>> Hello web2pyers
>>>>>
>>>>> I have a problem with encoding when I work with MSSQL with codepage
>>>>> other than latin1 or unicode
>>>>> Here is my DB connection
>>>>>
>>>>> dbsol = DAL
>>>>> <http://127.0.0.1:8000/examples/global/vars/DAL>('mssql://user:password@w2ptkts/SacuraOnline',
>>>>> db_codec = 'cp1251', migrate_enabled = False)
>>>>>
>>>>> I'm successfully read and and view any tables from my DB.
>>>>> But when I try to write to my DB, I see strange behavior, like occuring
>>>>> unwanted (or excessive) encoding.
>>>>>
>>>>> Here is example
>>>>>
>>>>> Also got an error while saving the profile with Cyrillic letters
>>>>>
>>>>>
>>>>>
--
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.