Re: [Dev-C++] Using Unicode in Dev-C++
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2007-04-26 13:00:26
|
There are windows API calls to convert between Unicode and MBCS (MultiByte
Character Set).
You can _never_ convert unicode to ANSI (other than for the characters
that fit in the ANSI character set).
You want to use a Unicode-compatible editor, i.e. an editor that checks if
there are a magic marker in the beginning of the file to inform that the
file is not ASCII (or ANSI or whatever single-byte format) but either UTF8
or UTF16.
/pwm
On Thu, 26 Apr 2007, Duong Ha Nguyen wrote:
> Hi Adrian, thank you for answering my question!
>
> I understand your answer. I tried to do as you said but I don't know how =
to
> type Unicode characters in Dev-C++ IDE. When I typed "=C6=B0", it display=
ed "?".
> Can you tell me how to solve it?
>
> I tried to convert Unicode characters to ANSI using native2ascii.exe (as =
I
> said at my first mail) but the displayed characters were not what I wante=
d.
> I think maybe there was some problems with the fonts. Can you tell me how=
to
> solve it?
>
> Thanks in advance,
>
> 2007/4/25, adrian <ad...@la...>:
> >
> > Have a nice day, nha...@gm...!
> > You, "Duong Ha Nguyen" <mailto:nha...@gm...> wrote:
> >
> >
> > >Hello everyone,
> > >I'm using Dev-C++ 4.9.9.2 to write Windows application. I would like t=
o
> > >write program using Unicode encoding. I tried to use native2ascii to
> > >translate Unicode source code to ANSI, but it didn't display exactly w=
hat
> > I
> > >want. Can someone tell me how to write Windows programs with Unicode i=
n
> > >Dev-C++?
> > >Thanks in advance.
> > >
> > >
> > WinAPI has a two function for straight working with Unicode strings:
> > - MultiByteToWideChar(...) - for encoding ANSI strings in Unicode, and
> > - WideCharToMultiByte(...) - for decoding Unicode to ANSI
> >
> > Also you can use TCHAR type for unvisible translating, for example:
> >
> > #include <windows.h>
> > #include <stdio.h>
> > #ifndef UNICODE
> > #define UNICODE
> > ...
> > TCHAR *s;
> > scanf ("%s", s);
> > printf("%s\n", s);
> > ...
> > #endif //UNICODE
> >
> > if you define UNICODE then
> > typedef wchar_t TCHAR,
> > else
> > typedef char TCHAR; also defined functions, working with this type (for
> > more see MSDN and tchar.h file)
> >
> >
> > Sincerely, Churin.
> >
> > P.S. Excuse me for my bad english - it's not my native language.
> >
> >
> >
>
|