Hi Alexei -
web2py uses UTF8 internally; this means Cyrillica will encode in 2-bytes per
character
(have a look at
http://en.wikipedia.org/wiki/UTF-8#Rationale_behind_UTF-8.27s_design,<http://en.wikipedia.org/wiki/UTF-8#Rationale_behind_UTF-8.27s_design>
or 
http://ru.wikipedia.org/wiki/UTF-8#Rationale_behind_UTF-8.27s_design)<http://en.wikipedia.org/wiki/UTF-8#Rationale_behind_UTF-8.27s_design>


I copy/pasted "Oleg Zumniy" from your note into development copy (sqlite) of
the PyCon2009 conference server...
>>> s=db(db.contacts.id>0).select()
>>> s[0].name
'\xd0\x9e\xd0\xbb\xd0\xb5\xd0\xb3
\xd0\x97\xd0\xb8\xd0\xbc\xd0\xbd\xd0\xb8\xd0\xb9'

As you can see - 2-bytes per character ...

SQLField defaults are shown on p.138 - 'string', length=32 is default.   Try
that, see if that works for you.

Hope that helps.

Regards,
Yarko

2009/3/21 Alexei Vinidiktov <[email protected]>

>
> Hello,
>
> I'm just beginning to learn web2py. I've bought the web2py manual and
> am reading Chapter 1.
>
> I've defined a model through the admin interface:
>
> db = SQLDB('sqlite://storage.db')
> db.define_table('contacts',
>    SQLField('name', 'string', length=20),
>    SQLField('phone', 'string', length=12))
>
> When I go to the admin interface to add some records, I can add names
> that are written with Latin characters just fine, but when I try to
> enter a name written with Cyrillic characters, I get an error that
> says that the name is too long, although it is not.
>
> For example, if I enter the name Олег Зимний, which is 11 characters
> long, I get that error.
>
> If I enter a short name such as Олег, the record is added fine.
>
> The maximum length is set to 20 in the table definition and names with
> Latin characters whose length is up to 20 characters can be added
> fine.
>
> Is it a web2py bug? If it is, can it be easily fixed?
>
> --
> Alexei Vinidiktov
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to