Unicode characters with VC6

I'm looking for a way to replace non-ansi characters in VC6.  For 
example, CString.Replace (_T("€"), _T("€")).

As VC6 doesn't support unicode source files, there is no easy way to put 
the character in the source code.
0
flect1 (54)
12/9/2006 6:51:23 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
808 Views

Similar Articles

[PageSpeed] 53

"flect" <flect@aol.com> wrote in message 
news:O3oIVM8GHHA.5020@TK2MSFTNGP03.phx.gbl...

> I'm looking for a way to replace non-ansi characters in VC6.  For example, 
> CString.Replace (_T("?"), _T("&euro;")).
>
> As VC6 doesn't support unicode source files, there is no easy way to put 
> the character in the source code.

I assume the standard method will work:

WCHAR c =  L'\x0102';

[This example is A with a caron.]

Dave
-- 
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm 


0
dave1 (355)
12/9/2006 8:56:00 PM
Thank you ;)
0
flect1 (54)
12/9/2006 9:49:20 PM
#define STRING_EURO L"\x20AC"
#define HTML_EURO _T("&euro;")

s.Replace(STRING_EURO, HTML_EURO)

I did this using a table of translations, where the table was iterated through.

Note that this only works in a Unicode build; otherwise you get a compilation error.

struct {
   LPCTSTR raw;
   LPCTSTR html;
} escapes[] = {
   { _T("&"), _T("&amp;") },
   { _T("<"), _T("&lt;") },
#ifdef _UNICODE
   { STRING_EURO, HTML_EURO },
#endif
   { NULL, NULL} // EOT
};

for(int i = 0; escapes[i].raw != NULL; i++)
   {
    s.Replace(escapes[i].raw, escapes[i].html);
   }

The trick is to make sure (a) no html escapes are already present and (b) & is the first
element of the table.

Note that some fonts support 0x80 as the Euro symbol, but right now the standard Western
code pages do not appear to support it.
				joe


On Sat, 09 Dec 2006 10:51:23 -0800, flect <flect@aol.com> wrote:

>I'm looking for a way to replace non-ansi characters in VC6.  For 
>example, CString.Replace (_T("�"), _T("&euro;")).
>
>As VC6 doesn't support unicode source files, there is no easy way to put 
>the character in the source code.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15979)
12/10/2006 5:05:54 AM
Reply:

Similar Artilces:

How can I get underlying range when Series Formula is longer than 255 characters?
I am trying to write a macro that will navigate to the range that a series represents. I do this by parsing Series.Formula. however, if the Series.formula is longer than 255 chars, it gets truncated. Is there any way to get the range in a situation like this? Here is some code that generates a problem chart: Sub CreateChartWithTrickyFormula() ' ' Macro2 Macro ' Macro recorded 12/4/2007 by saldanha ' Range("A1:A34").FormulaR1C1 = "=RAND()" Range("C1:C34").FormulaR1C1 = "=RAND()" Charts.Add ActiveChart.ChartType = xlColumn...

Which control should I use to display Unicode characters?
Hi, there, I want to show Unicode characters, such as Chinese and Arabic. Which control should I use? Could you please give me a bit of example code? Thanks a lot. Gary You do not need specific control to display Unicode strings. Normally, you would use SetWindowText function to set the control text. If you look in winuser.h file this 'function' #defined as SetWindowTextA or SetWindowTextW (depending on the type of the build). If you want to use Unicode text regardless of build type, specify SetWindowTextW explicitly. Note that you need to have appropriate fonts installed to a...

deleting characters from beginning of call
is it possible to highlight multiple cells and delete characters from the beginning of them? Hi, do you have an example ?, if you want to delete let' say " you can do just find and replace , find what ", replace with do not enter anything and clidk on replace "fazz" wrote: > is it possible to highlight multiple cells and delete characters from the > beginning of them? "fazz" wrote: > is it possible to highlight multiple cells and delete characters from the > beginning of them? Can you give an example of some of the da...

unicode application
hi, Priyanka here, this is a question related to VB. i want to make the VB application unicode based. i am not able to do it right now. if anybody knows please let me know about this. ...

VERIFY and TRACE, how to implement for debug/release, unicode-aware, no warnings at lvl 4
Hi group and apologize because this isn't a pure MFC-question. I have to finish a raw win32 app written in C++. I really miss the macros TRACE and VERIFY, which I tend to use when writing MFC programs. I googled for "win32 verify macro" and the very first hit is for a codeproject.com project with implementations to be used in a win32 program, however. The project contains a single header file, debug.h, but it doesn't compile without warnings (using warning level 4), doesn't seem to be unicode aware and doesn't compile at all in release mode. I was just wonderin...

Unicode
I want to make an application for international use which should all languages(which unicode support). So i want to know how to change language? or in ther words, how to change my Locale( at run time). ...

How to convert to unicode in ADSI
Hi all, I made a vbs to add an extra e-maill address to a distribution list group. The e-mail address should be <group name>@dnv.com. As we are a Norwegian company, the group name sometimes contains Norwegian character such as "Ø". When I look into ADSI, the string with "Ø" do updates in "mail" attribute. But if I want to send e-mail to this distribution goup, error will report that "The format of the e-mail address is incorrect". I found if I manually create the e-mail address, the system will automatically convert ...

Criteria if 1st Character might be a space
I have set up a query that accepts input from a text box. It appears some of the data in the criteria field be start with a space and some do not. I tried to concatenate a space " " & [Forms]![Form1].[Form]![Text1], but of course that only works if there is a space. What is the syntax to find a record if this field does or does not have a leading space? Like " *" should do the trick for you. If this will be run in VBA, use " %" instead. -- hth, SusanV "JoeA2006" <JoeA2006@discussions.microsoft.com> wrote in message news:1FB2F479-0946-4...

ftpd unicode
In Wince 5.0 file and folder names may contain UNICODE (e.g. cyrillic or chinese)characters. I was not able to transfer such files via FTP. I think it is a problem of ftpd. Any suggestions ? Tank you You've got full source code of FTPD, so clone it (see my blog) and change it to whatever you need, or buy a 3rd party FTP implementation for CE. Note that FTPD is shipped as "Sample" meaning it's not a full featured final program. Good luck, Michel Verhagen, eMVP Check out my blog: http://GuruCE.com/blog GuruCE Microsoft Embedded Partner http://...

Clipboard for Unicode and Non-Unicode
Hi all, We have a progarm write with non-unicode. I found that in some language, the character can not be pasted to CEdit correctly. For example, if our application is running on Russian XP, the string copy from IE can be pasted to CEdit properly. But if I pasted the same string into Notepad, and then copy the string from notepad to our CEdit, the string can not show corectly. Is it a coding problem? Is it possible to make CEdit to accept the string from notepad? Thanks, Justin If it is a question of pasting a UTF16 string into a single-byte edit control, you could try it in two stages: L...

question re international characters in e-mail message
I have my keyboard set up as US - International. For me to type the Euro symbol, I simply press CTRL + ALT + 5 and I see €. I just now responded to an e-mail where I could not enter that symbol. I created a new e-mail message and there was no problem for me to enter that symbol. Can someone else's e-mail message have a built in limitation that precludes me from responding using that symbol .... or was this a one time glitch? Thanks, Dave Horne You might have additional keyboard layouts/languages installed which doesn't support that character. See http://www.msoutlook.info/...

How do you enter Unicode characters that don't have a Alt-nnnn shortcut?
I have a need to enter a range of non-English names into a combo box on a form in an Access 2003 application. Sometimes this requires the use of accented characters that do not appear on a UK keyboard. If I refer to the Windows XP Character Map facility (charmap,.exe) then I can see that many such foreign characters have been allocated an Alt-nnnn code that is displayed at the bottom right of the Character Map acreen. This makes it easy to enter these characters. However, many other characters have not been given an Alt-nnnn keyboard shortcut. They only have a U-FFFF code, displayed at...

Invalid character in XML
Hi there, I have a 600MB xml file that I am trying to pull a small amount of data from, using an XMLTextReader in C#. All works well, until I get an exception thrown in linw 4,277,905 because of an illegal character for the encoding type. "There is an invalid character in the given encoding. Lin 4277905, position 26." Now, this file is obviously fairly large - too large for a text editor - so I was wondering two things 1) Is there a way to change the encoding type of the XmlTextReader object? (I had a quick look but it seems to be read only) 2) Is there another way to ignore...

Character code for ALT-ENTER
Hi All, I am extracting data from excel and I need to know if the data has been wrapped by setting the cell properties. I have been told that excel uses ALT-ENTER to put a soft break in a line. Can anyone tell me what character code this will equate to? TIA Peter Peter Longstaff wrote: > I have been told that excel uses ALT-ENTER to put a soft break in a line. > > Can anyone tell me what character code this will equate to? The character is still the Enter key, but it's sent to the application via WM_SYSKEYDOWN and WM_SYSCHAR messages. -- Regards, Tobias Tobias G�ntne...

Opening CSV file(saved in unicode) in excel
Hi, If anyone can help me on this, I would really appreciate that. I have a file that is saved in .csv extension (Unicode format). Let's say for example, I have the data as follows: "text1","text2",123,"text3",450.00 When I save the above data in .csv (in Ascii format) and open in excel file, I see that each value is placed in adjacent columns. When I save the same data in .csv (Unicode) I see the whole information appears in the single cell(first cell only). Is there a limitation to the CSV FILE opening in EXCEL, with Unicode format? Any inputs/...

unicode format files for Outlook 2002
I use Outlook 2002. I would like to use Unicode files (for larger size). I see references to using it with Outlook 2003, but none for 2002. can unicode files be used with Outlook 2002? If so, how? thanks, Huck No OL 2003 & 2007 only "Huck Rorick" <huckrorick@groundwork.org> wrote in message news:epYUYAl4IHA.2348@TK2MSFTNGP06.phx.gbl... >I use Outlook 2002. I would like to use Unicode files (for larger size). >I see references to using it with Outlook 2003, but none for 2002. can >unicode files be used with Outlook 2002? If so, how? > > than...

Telnet to SMTP results in garbage characters, but only from other WAN sites???
We have two RG connectors (one each direction) connecting two RG's together. The two offices are physically connected via VPN WAN link. RG A can email RG B, but email from RG B to RG A is stuck in the RG connector queue. Eventually the mail will go through, after 10 minutes or so, but it sits there for a while in the queue. While trying to diagnose the problem I found that from within RG A, if I telnet to the local Exchange server, it works fine. From any other WAN site, if I telnet to the Exchange server in RG A, I get garbage characters instead of the SMTP banner at the top of th...

Unicode problem
Given the following code snippet: WNetOpenEnum( dwScope, 0, 0, NULL, &hEnum ); struct hostent *host; DWORD Count = 0xFFFFFFFF; LPVOID Buffer = new char[16384]; DWORD BufferSize = 16384; WNetEnumResource(hEnum, &Count, Buffer, &BufferSize); NetResource = (NETRESOURCE *) Buffer; for (int i = 0; i < Count; i++, NetResource++) { CString strFullName = NetResource->lpRemoteName; ... host = gethostbyname((LPCTSTR) strFullName); } This works when I do *not* have _UNICODE and UNICODE defined. When I *do* define those directives, I get a compiler error on the call to the...

printing UNICODE and convert CString to UNICODE
1.how do i convert some CString to UNICODE ? ? ? i search in MSDN and i dont understand how to do it . 2. i writing some program and i need to send some CString to printing . in my CString there is some local language (not eanglish) and the printer always give me some GIBRISH data. pleace , someone can help me ?? ? tanks. For 1: Use MultiByteToWideChar() Or, Use a CStringW and initialise it from your CString. For 2: You will need to give more information about how you are getting your text to the printer. You should be getting a device context for the printer and use DrawText or a ...

Max number of characters in a cell
Is it possible to have more than 1024 characters in a cell? I have tried to use char(10) and char(13) however while the formula allows me to copy and paste more than 1024 characters it limits my statements to 100 characters after 1024. Is there any way to go around this and be able to have as many characters as one wish in a cell. Thanks You might search on "limits" in Excel help for this and other limits. A cell can hold a text entry of a max of 32k characters. A formula can have about 1000 characters. -- Jim "Dajana" <Dajana@discussions.microsoft.com>...

create csv which contains unicode
i want to create csv which contains unicode can anyone help me out Requirement is not clear. Use Excel to create the unicode content and then save as CSV or Unicode txt format. "archana" wrote: > i want to create csv which contains unicode > can anyone help me out ...

Unicode Support
Is there a way to insert characters in Microsoft Office V.X Applications, such as Unicode 010D and 0117 (c with a caron above it and e with a dot above it)? They don't seem to appear in the Insert -> Symbol box, and I can't insert them from the OSX Character Palette. Thanks for your help! Dave Feucht Dave Feucht <davidf@cs.pdx.edu> wrote: HI Dave, > Is there a way to insert characters in Microsoft Office V.X > Applications, such as Unicode 010D and 0117 (c with a caron above it > and e with a dot above it)? They don't seem to appear in the Insert &g...

User ID more than 15 characters
Some customers manage user ID like are named in active directory... Great Plains only accept 15 char max. -- Evelin. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=4e13...

trying to export .aba file from Palm Desktop to .csv file and having problems with irregular characters
I'm getting these odd square characters in my notes section of the .csv file which I think are carriage returns in palm desktop that are unrecognizable to excel. Any idea how to eliminate them? Here's a pic of what they look like" http://img176.imageshack.us/my.php?image=howtoeliminatesquareseu6.jpg > I'm getting these odd square characters in my notes section of > the .csv file which I think are carriage returns in palm desktop that > are unrecognizable to excel. Any idea how to eliminate them? > Here's a pic of what they look like" I hate to ask what...

Handling UNICODE #2
Hello, again Here is another problem (at least for me). In the edit control non-English string is displayed properly. There is a member variable for this control, of a CString data type. My question is - how to assign this non-English string to this variable? I mean when I'm calling UpdateData(TRUE), in Debug the value for this member data is "??????" and also when I'm reading recordset, which returns this non-English value properly, (I can see it running corresponding stored procedure in Query Analyzer), the variable of a type _bstr_t, which receiving the value also look...