[Lexical Cast] Strange behaviour
I know this is not new, but I've just bumped into it....
This code
#include <iostream>
#include
Hello, I am reading data from postgresql via ODBC encoded in UTF-8. I am trying to verify that I am indeed reading the right data (I do not need to manipulate). Simple output, of course does not work and Visual Studio '08 debugger just shows question marks. So I wanted to try and convert to double byte using Boost UTF8 facets but I am simply lost at how to do this. It appears that I cannot include any header files. There is a reference to it in serialization pages, but not clear how to include / use it namespace fs = boost::filesystem; std::locale global_loc = std::locale(); std::locale loc( global_loc, new fs::detail::utf8_codecvt_facet ); fs::wpath_traits::imbue( loc ); But this does not work in 'User' files because unless you are a boost library the detail::utf8_codecvt_facet is not available. So my question is, is there a way to use boost to either printout to a file UTF8 or to convert it to UTF-16 and see it may be in the debugger? thanks in advance -- V S P toreason@fastmail.fm -- http://www.fastmail.fm - Send your email first class
V S P wrote:
Hello, I am reading data from postgresql via ODBC encoded in UTF-8.
I am trying to verify that I am indeed reading the right data (I do not need to manipulate).
You can also try http://utfcpp.sourceforge.net/ which assumes that a std::string can hold UTF-8 data.
Hi Robert, My MSVC ionstallation is broken. Can you please build the following program, pass -1 to it and check the exit code? #include <iostream> int main() { unsigned int i; std::cin >> i; return std::cin.good() ? 0 : 1; } Alex
On Wed, Mar 18, 2009 at 4:16 PM, Alexander Nasonov
Hi Robert, My MSVC ionstallation is broken. Can you please build the following program, pass -1 to it and check the exit code?
#include <iostream> int main() { unsigned int i; std::cin >> i; return std::cin.good() ? 0 : 1; }
Ah, good plan, I'll do it tm when I have the compiler available. Ultimately I believe the behaviour occurs because strtoul() returns the global errno, and it's not checked by the streaming lib, so it will be interesting to see the stream state. Cheers, Rob.
participants (4)
-
Alexander Nasonov
-
Robert Jones
-
Sohail Somani
-
V S P