I am facing problem with German Characters while using ODBTP. Multi byte characters like Chinese are fetched without any problem. If some fields contain other special characters like German, that field comes BLANK. When I used FREETDS, German characters were fetched without any issue, but Chinese characters showed problem. I am really fed up with this issue. All suggestions really appreciated.
Thanks in Advance
Vinod
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you are using the same field to store both Chinese and German, then I assume you are using a UNICODE field (nchar, nvarchar or ntext). Text stored in these type of fields are returned by the ODBTP as UTF-8 encoded text, regardless of the language.
Text from the non-UNICODE field types char, varchar and text are returned without any encoding. This may be a problem if you are displaying both UNICODE and non-UNICODE text simultaneously. If this is the case, you must set the attribute ODB_ATTR_MAPCHARTOWCHAR to TRUE after connecting to the database.
To store text in a UNICODE field, ODBTP requires the text to be UTF-8 encoded. You then either must use odbtp_prepare(), or set the attribute ODB_ATTR_UNICODESQL to TRUE to use odbtp_query(). For the latter, the entire SQL text statement must be UTF-8 encoded, and string literals corresponding to a UNICODE field must be prefixed by the letter N.
-- bob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am facing problem with German Characters while using ODBTP. Multi byte characters like Chinese are fetched without any problem. If some fields contain other special characters like German, that field comes BLANK. When I used FREETDS, German characters were fetched without any issue, but Chinese characters showed problem. I am really fed up with this issue. All suggestions really appreciated.
Thanks in Advance
Vinod
If you are using the same field to store both Chinese and German, then I assume you are using a UNICODE field (nchar, nvarchar or ntext). Text stored in these type of fields are returned by the ODBTP as UTF-8 encoded text, regardless of the language.
Text from the non-UNICODE field types char, varchar and text are returned without any encoding. This may be a problem if you are displaying both UNICODE and non-UNICODE text simultaneously. If this is the case, you must set the attribute ODB_ATTR_MAPCHARTOWCHAR to TRUE after connecting to the database.
To store text in a UNICODE field, ODBTP requires the text to be UTF-8 encoded. You then either must use odbtp_prepare(), or set the attribute ODB_ATTR_UNICODESQL to TRUE to use odbtp_query(). For the latter, the entire SQL text statement must be UTF-8 encoded, and string literals corresponding to a UNICODE field must be prefixed by the letter N.
-- bob
Wow!!!! The solution worked. Million Thanks, Bob.
--Vinu