?
Solved

CDaoDatabase unicode problem

Posted on 2004-08-02
6
Medium Priority
?
295 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 2000 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

770 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