[mod_python] Encoding problems

S.R.Pardá linux at qbox.es
Fri Aug 3 05:33:40 EDT 2007


Hi,

I have problems in a *.psp page, where I have code like :

	
	File xx.psp:

		<%
		table = Table()
		table.select('tipo','3AÑOS')		
		%>
        
        
        
        
	File tables.py:

		# -*- coding: utf-8 -*-
	
		...

		class Table:
			...
			def select(self, column, value):
				...
				lowerValue = str(value).lower()
				....
				where = 'WHERE lower(%s) = %s' % (column, lowerValue)
				...

			...
		...





But in expression:  str(value).lower()  
I obtain 3aÑos instead of 3años.



I am considering to change the where line to: where = 'WHERE lower(%s) =
lower(%s)' % (column, value)
In that case it works OK in the postgregsql 8.2 database with UTF-8
encoding.


But I want to know what I am not doing OK, to avoid future problems with
character codification.



Thank You.





More information about the Mod_python mailing list