05-25-2010 09:33 AM
I have a nagging problem and this is driving me nuts! I've exhausted my option experimenting with fonts and commandline switches so all the CVI veterans please help.
I have an application that launches a commandline utility in a hidden command shell in XP (XP Pro SP3, fully patched). As part of the commandline parameters that I pass to this utility I am passing a string including the copyright character - © (ALT+184). On one system (A Dell PC with XP Pro SP3 fully patched) this works fine, but on a similar setup (HP PC with XP SP Pro fully patched) it fails and renders a linedraw character in the output.
A simple test on my working system yields a "©" when I type ALT+184 into the command window. Repeating ALT+184 on the failing system I get "╕" and regardless of the font set chosen for the command window, this is what I get. The command line character set does not match the font set characters in the same window font.
I need a consistent way to pass strings to my command shell application that is not PC setup dependent and if I can determine what is different I can either intelligently switch sets or make them all look the same.
Any experience and pointer in the right direction is much appreciated.
Thanks
Jattie
05-25-2010 09:44 AM
Hello Jattie -
Are you sure the alt code is 184? It looks to me like the code should be Alt + 0169
NickB
National Instruments
05-25-2010 09:51 AM
Hallo Nick,
yes I am sure and what you experience is exactly my problem, the character sets are inconsistent.
If I type in what you suggested, i.e. ALT+0169 I get "®"
Taken of my PC:
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Program Files\verinfo>®
Maybe that is why even Microsoft use (C) instead of "©". My problem is that this is the case with any but the normal characters (A-Z, a-z, 1-9) and I have no way to pass the same special string across diffirent installs of XP/Vista/7.
05-25-2010 12:46 PM
Hello Jattie,
The problem you're running into is that the character codes between 128 and 255 are not a universal standard. Their mapping depends on which Windows code page you end up using with a particular font. By default, CVI uses the native code page that's defined for your PC, which can change whenever the user changes the OS settings (in XP, you can change this in Control Panel>>Regional and Language Options, Advanced tab). Most western languages use code page 1252 which has the copyright symbol in character 169.
If you want to ensure that 169 always maps to the copyright symbol, you should change the character set attribute of the UI control from "Native" (VAL_NATIVE_CHARSET) to "Western" (VAL_ANSI_CHARSET) which should ensure that the mapping will remain constant, regardless of which computer you display your UI on.
By the way, I wouldn't trust the code that you enter with the numeric keypad (Alt+ + ...) to be very reliable. Different keyboard drivers might do different things. If you really want to test your solution, you should set the '169' character programmatically.
Luis
Luis