Solved

CDaoDatabase unicode problem

Posted on 2004-08-02
6
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get filename and folder into excel 7 87
windows 10 how make picture as desktop background 2 71
Window placement 17 99
scoreUp challenge 14 73
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: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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…

739 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