I wrote a large project dealing with images, files, and WINAPI functions.
I decided to add RichTextEdit to it and used the msfedit.dll.. Turns out that it only supports UNICODE style strings and chars and my entire project is std::strings and LPCSTR's, etc..
None of the WINAPI functions are unicode either..
I'm thinking of converting the whole project to unicode so I won't face such a problem further along the line but I don't know where to start because it's a mixture of everything!
Bitmaps use chars and unsigned chars.. I can't think of a way to read a bitmap using wchar_t.
Things like ZLib and LibPng use FILE*, gzopen, and fopen, and base64 chars.. how would I work around that?
Reading with fstream vs wfstream and printing with cout vs wcout.. Is there any typedefs to enable either or? Just incase I decide I don't like Unicode? What happens if I read a file using wfstream, will it be the same as fstream but just able to support more characters?
I made a file like below:
#ifndef UNICODE_HPP_INCLUDED #define UNICODE_HPP_INCLUDED #include <tchar.h> #include <iostream> #define UNICODE #define _UNICODE #ifdef UNICODE typedef std::wstring string_type; typedef wchar_t char_type; typedef std::wfstream fstream_type; typedef std::wstreambuf streambuf_type; #else typedef std::string string_type; typedef char char_type; typedef std::fstream fstream_type; typedef std::streambuf streambuf_type #endif #endif // UNICODE_HPP_INCLUDED
Would I need anything else? Will this break my project? What's the best approach to support Unicode and ANSI?
Edited 3 Years Ago by triumphost