08-23-2012 04:33 PM
Hi All,
I am trying to print the ascii value of the trademark symbol(ascii = 153, type it by holding Alt and type 0153 using numpad) using string to byte array, but it's returning the value 34,33. Interesting thing is it is returning 2 values.
I am attaching the vi here. Could anyone please take a look at it and let me know if it is a bug.
Thanks,
Ritesh
08-23-2012 04:49 PM - edited 08-23-2012 04:50 PM
08-23-2012 04:58 PM
It also depends on the OS. The circled R maps to decimal 168 on the Mac.
Several extensions to the 7-bit ASCII set exist and not all are compatible.
Lynn
08-23-2012 04:59 PM
You are entering two characters. Why don't you set your string control to hex display and enter 99 instead? You might also want to read this document.
Dumb question: If I press "alt", I cannot enter anything. It simply highlights the file menu (LabVIEW 2012)
08-23-2012 05:11 PM
It is easy to send byte patterns to a string control/indicator that cause the encoding to flip out, probably what happened here.
For example:
Change the input of the byte array to 2 elements: [0,153]
Run the VI: 'string' shows a space (null) + trademark symbol
Copy the 'ASCII' string, paste into 'string' indicator. Still looks like the trademark symbol.
Run the VI again: Mojibake.
Change the input of the byte array to [34,33]
Run the VI again: trademark
String Encoding+LabVIEW=Trainwreck
08-23-2012 05:12 PM
08-23-2012 05:16 PM
Ah, my laptop does not have a number pad... 😞
08-23-2012 05:20 PM
@altenbach wrote:
Ah, my laptop does not have a number pad... 😞
Neither does mine, but it does have a Function (Fn) key which helps many of the keys serve double duty (the alternate values are tiny and colored purple). Amongst the alternate values are the number pad keys.
08-23-2012 05:37 PM - edited 08-23-2012 05:42 PM
Yes, I know it's there somewhere, but I never use it, ever.
Fn-num-lock, then use some of the specially marked keys near the right (e.g. k=2, o=6)
08-24-2012 02:05 AM - edited 08-24-2012 02:07 AM
Darin.K wrote:
String Encoding+LabVIEW=Trainwreck
Make that String Encoding + anything = headache
It's not that LabVIEW is particularly bad in that, just more limited than when you use for instance a C runtime library. But not so much for the worse, since getting string encoding right in a C program is a major pitta.
Having more freedom often isn't better especially in programming. And making string encoding right in a single platform application IS hard, making it right in a multiplatform way, is a project that nobody has fully tackled so far.