Solved

CDaoDatabase unicode problem

Posted on 2004-08-02
6
284 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now