I have a Django (1.2.x) project that is designed to support German and English languages. The project is hosted on a Linux box, behind Apache (2.x) using mod_wsgi
. The database is hosted on an SQL Server 2005 running on Windows on a separate box. The easysoft SQL Server ODBC driver is used to connect the project with the database.
I will use one of the models in one of the applications in the project as an example for this question. This model in question contains a TextField. This field is translated into an NVARCHAR(MAX) column type in the table in SQL server. The encoding for the database is set to "Latin1_General_CI_AS". The easysoft unixODBC source is configured to use the ConvToUtf = 1
which essentially converts the data from UCS-2 encoding into UTF-8 encoding when returning it back to the application from the database. (I mention UCS-2 here because I've read and found that the SQL server stores Unicode data in UCS-2 encoding.)
However, when viewing data that is stored in the database through the admin panel, the German characters are transformed into weird symbols (this is visible both when viewing the data on the admin panel, as well as within APIs that return data in JSON format).
An example is the following German word: Geschäftsbedingungen. After it has been saved in the database, it comes out as: Geschäftsbedingungen.
The version of Python running on the Linux box is Python 2.6. I am not sure what other information I should provide to be able to provide more context into the problem.
Apparently, I've tried a couple of things, to no avail. I am looking for any clues on how to go about fixing this problem. Any help with this will be greatly appreciated.
UPDATE: If the data, I've found, is saved directly into the database table by editing the table through the SQL Management software, the data displays fine on both the Django admin page as well as the API. This is puzzling. When the data is saved through the admin panel, the strange characters appear.