Overview
Features
Download
Documentation
Community
Add-Ons & Services

Using Typehandler and Session with std::wstring

A general discussion forum.

Using Typehandler and Session with std::wstring

Postby athkou » 07 Dec 2009, 11:43

Hello everybody. In my mySQL tables I use a utf8 character set for my column's because I need to store greek names. Unfortunately when I try to display some text in my application I only see ?. I thought that I only need to do is to change the character set, from the configuration properties, from Multibyte to Unicode and to use std::wstring instead std::string. When I'm trying to compile the project I get an error with TypeHandler and Session:

C:\DEV\poco\Data\include\Poco/Data/TypeHandler.h(124) : error C2664: 'void Poco::Data::AbstractBinder::bind(size_t,const Poco::Int8 &)' : cannot convert parameter 2 from 'const std::wstring' to 'const Poco::Int8 &'
Reason: cannot convert from 'const std::wstring' to 'const Poco::Int8'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called



As long as I use std::string the TypeHandler works fine but it isn't a solution. Another problem is that I can't use a Session object with std::wstring. My Question is: Is there any work around to use session and typehandler with std::wstring? Or is it possible to have unicode support with std::string for Windows and I am doing something completly wrong?
athkou
 
Posts: 5
Joined: 04 Sep 2009, 18:44

Re: Using Typehandler and Session with std::wstring

Postby alex » 07 Dec 2009, 13:34

athkou wrote:As long as I use std::string the TypeHandler works fine but it isn't a solution. Another problem is that I can't use a Session object with std::wstring. My Question is: Is there any work around to use session and typehandler with std::wstring? Or is it possible to have unicode support with std::string for Windows and I am doing something completly wrong?

It depends what your driver does. If you can get UTF-8 into std::string, then Poco::UnicodeConverter will do the job for you.
alex
 
Posts: 1086
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Using Typehandler and Session with std::wstring

Postby alex » 07 Dec 2009, 14:02

athkou wrote:I thought that I only need to do is to change the character set, from the configuration properties, from Multibyte to Unicode and to use std::wstring instead std::string.

Poco operates in UTF-8 (that's the only way to remain portable). So trying to recompile with Unicode will not do anything for you. Stick with UTF-8 and use Poco::UnicodeConverter. SVN trunk ODBC code has Unicode support, but that has not been released yet and was not tested on non-windows platforms.
alex
 
Posts: 1086
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: Using Typehandler and Session with std::wstring

Postby athkou » 08 Dec 2009, 11:43

Thanks for the answers.
athkou
 
Posts: 5
Joined: 04 Sep 2009, 18:44


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests