[web2py] Re: Codec MS-SQL, unicode Latin1 UTF8
I use this same stack, and ran into encoding issues when updating the database, because of FreeTDS v.91. But upgrading to FreeTDS v1.00.40 fixed all unicode issues: https://github.com/mkleehammer/pyodbc/issues/244 Connect with mssql4n, TDS_Version 7.1+, no need to set db_codec On Friday, 19 May 2017 02:07:27 UTC+1, Jose wrote: > > Hi J-Michel Angers > > Given: > pydal <-> pyodbc <-> UnixODBC <-> FreeTDS <-> MSSQL > > In freetds.conf I have: > > client charset = UTF-8 > > and in pydal I use mssql2 adapter, db_codec is not necessary > > Jose > -- 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.
[web2py] Re: Codec MS-SQL, unicode Latin1 UTF8
HI, I am using mssql4 adapter. For table: CREATE TABLE myTable ( Column_a varchar (10) COLLATE French_CI_AS NOT NULL, Column_b varchar (10) COLLATE Latin1_General_CI_AS NOT NULL, Column_c varchar (10) COLLATE Estonian_CS_AS NOT NULL) I create a view: CREATE VIEW v_myTable AS SELECT CONVERT (nvarvhar (10), Column_a) AS Column_a, CONVERT (nvarvhar (10), Column_b) AS Column_b, CONVERT (nvarvhar (10), Column_c) AS Column_c FROM myTable I connect the adapter to the view Now everything works well -- 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.
[web2py] Re: Codec MS-SQL, unicode Latin1 UTF8
Hello, Many thanks at both of you :-) I've just made a lot of tests, a lot of combinations I confirm : mssql4 is NOT the good connector for this. mssql2 works much better ! ! For unicode fields (type nvarchar in SQL-Server), mssql2 without codec works very well, but doen't work for varchar fields (not unicode in SQL-Server). For traditionnal fields (type = varchar), mssql2 AND db_codec=latin1 make the fields working perfectly ! mssql3 also doesn't work. So I can now continue working on my workflow, it's very plaisant to see beautiful letters, like I used to :-) So my definitiv choice : mssql2 AND db_codec='latin1'. Thank you very much, and long life to web2py. -- 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.
[web2py] Re: Codec MS-SQL, unicode Latin1 UTF8
Hi J-Michel Angers Given: pydal <-> pyodbc <-> UnixODBC <-> FreeTDS <-> MSSQL In freetds.conf I have: client charset = UTF-8 and in pydal I use mssql2 adapter, db_codec is not necessary Jose -- 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.
[web2py] Re: Codec MS-SQL, unicode Latin1 UTF8
Hello J-Michel Angers I had have that problem and I dont remember how i fixed... jajaja what type of fields you are using ? nchar o char ? this determines what kind of connection need to use. There are a few options; mssql, mssql2, mssql3 and mssql4. If you are using nchar you need mssql2. In my esperience, you can use the others options and can still read data in a proper way but are more dificult because you need to decode and encode things all the time and take care of anything are talking in the same encodings... The encoding of you python and html files are important too, dont forget the encoding sentence at begining of your python code. I minimize problems with this configurations: # -*- coding: utf-8 -*- in the python files. UTF8 without BOM as enconding format in of any files in the proyect. -- 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.