Solved

CDaoDatabase unicode problem

Posted on 2004-08-02
6
291 Views
Last Modified: 2013-11-20
Hi,
I am writing an application which is a console based program using CDAODatabase and another static library.  The library i am using cannot handle unicode builds of the application, so I have to build it using multibyte.  The values in the database are in unicode, my problem is that the values returned from the database are in multibyte.  Does anyone know how to retrieve the value in unicode with a multibyte build?  Thanks in advance.
0
Comment
Question by:poor_guy
  • 3
  • 2
6 Comments
 
LVL 16

Expert Comment

by:nonubik
ID: 11692313
You need to convert each value returned from database from multibyte to unicode, using mbstowcs(..) function, for example.
0
 

Author Comment

by:poor_guy
ID: 11700562
Thanks for the reply.
I've tried that, but when the values are retrieved from DB, it is converted to multibyte chars and the multibyte chars are all converted to the default locale of the OS.  So the data in other langauages becomes question marks.  eg) my locale is in chinese, my DB has english, chinese, japanese and korean, after i get the data, they are all converted to chinese, so the japanese and korean data becomes garbage.  Therefore, using the mbstowcs function will only change the english and chinese data to unicode.
0
 
LVL 16

Accepted Solution

by:
nonubik earned 500 total points
ID: 11701164
You shoud try to call setlocale(..) or _wsetlocale(..) with the desired language before retreiving the data from db. Maybe they won't get converted. Remeber to set it back to original on app exit.
0
 

Author Comment

by:poor_guy
ID: 11711883
Thanks nonubik, but using setlocale would mean that I have to know the language for each record before I retrieve them, which is not possible in my case because the application that inputs the value allows the user to input unicode data and I have no idea what the user's input language is.  The only way that I can think of is to retrieve wide characters from the database from a multibyte build and I've been searching for days and couldn't figure out how.  Please Help!
0
 

Author Comment

by:poor_guy
ID: 11759171
Anyone have any suggestions? Thanks.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
set up trigger (or something) to rename files (starting with ATL) in a linux directory 6 55
sum67 challenge 35 107
pre4 challenge 19 103
JQuery serialize and unserialize 8 132
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question