Jump to content

Write Extended ASCII Characters to a file


Recommended Posts

Hello all!

I need to write, to a txt file, some of the extended ascii characters, specifically the "box drawing" type such as alt+203, alt+204, etc. How is that done in LabVIEW? I've done it with unicode (by writing FFFE 6625 for example, to get one of the characters), but as you know, the file resulting Unicode becomes useless to LV when you read it and parse for data later.

Thanks,

Richard

(lv 8.2.1)

Link to comment

QUOTE(BrokenArrow @ Oct 2 2007, 11:13 AM)

I need to write, to a txt file, some of the extended ascii characters, specifically the "box drawing" type such as alt+203, alt+204, etc. How is that done in LabVIEW? I've done it with unicode (by writing FFFE 6625 for example, to get one of the characters), but as you know, the file resulting Unicode becomes useless to LV when you read it and parse for data later.

You can write the extended characters just as you would a normal character. The problem might be that Windows and DOS use different character encodings. If you have a file containing extended characters and open it with Notepad, you'll see lots of vowels with umlauts and accents. If you open the same file in a DOS window, you see the box-drawing characters. Character 203 (0xCB) is a capital E with an umlaut in Windows, but displays as a double-walled box character in DOS. You can use a string constant with the slash display or hex display to get to the extended characters without worrying about how they are displayed in LabVIEW.

Link to comment

QUOTE(BrokenArrow @ Oct 2 2007, 09:13 AM)

Hello all!

I need to write, to a txt file, some of the extended ascii characters, specifically the "box drawing" type such as alt+203, alt+204, etc. How is that done in LabVIEW? I've done it with unicode (by writing FFFE 6625 for example, to get one of the characters), but as you know, the file resulting Unicode becomes useless to LV when you read it and parse for data later.

Thanks,

Richard

(lv 8.2.1)

╩ don't think LabVIEW supports the characters you are trying to use. I attempted a similar thing a while back and never came up with a way to do it. It seems like the characters automatically get converted to something that LV can handle.

Edit: I looked into it some more and it looks like the box characters you are trying to write (╦╔╚ etc) are actually Unicode characters and not extended ASCII. The true extended ASCII characters appear to be supported.

Link to comment

Thanks for all the response. Yep, this seems like more trouble than it's worth. The customer is used to an old DOS-based text file that had those box characters. The way I got LabVIEW to do it was to send FFFE 6625 and I got ╦. BUT, when it writes the "txt" file, and you open it in notepad, sure enough it looks fine, but it says it's Unicode encoded. Try to read that file BACK into LabVIEW and it's SOL.

Thanks for the education, I didn't know "extended ASCII" was so softly defined, since I've been using those alt+200 type things successfully since 1986 in DOS, I just figured it would work the same way in LV.

-Richard

Link to comment

QUOTE(BrokenArrow @ Oct 2 2007, 03:55 PM)

Thanks for all the response. Yep, this seems like more trouble than it's worth. The customer is used to an old DOS-based text file that had those box characters. The way I got LabVIEW to do it was to send FFFE 6625 and I got ╦. BUT, when it writes the "txt" file, and you open it in notepad, sure enough it looks fine, but it says it's Unicode encoded. Try to read that file BACK into LabVIEW and it's SOL.

Thanks for the education, I didn't know "extended ASCII" was so softly defined, since I've been using those alt+200 type things successfully since 1986 in DOS, I just figured it would work the same way in LV.

-Richard

Those box characters did even in DOS only show up if one didn't use some other codepage for displaying. Now caused codepages in DOS such a pain that they were not as often used so you could usually get away with this, but Windows 3.1 extended the codepage idea greatly and made serious use of it before they implemented 16bit Unicode support in Windows NT and ported it back for Windows 95. Only with Unicode was it possible to have support for displaying different languages at the same time without constantly having to switch codepages. Another means for that was MBCS (multibyte character encoding)which is what LabVIEW uses itself to support eastern languages in its localized versions but that is quite a painful standard as a character can have a varying number of bytes, with certain codes reserved to indicate the switch to a different "codepage".

While the display of the lower half of ASCII characters is well defined, what is displayed for the higher half depends on the viewer and its interpretation. If displayed in a Windows (and LabVIEW) control you can also get away with setting them to certain fonts as every font has an implicit codepage for its first 256 characters.

Rolf Kalbermatter

Link to comment

.... If displayed in a Windows (and LabVIEW) control you can also get away with setting them to certain fonts ......

Rolf Kalbermatter

Indeed. But getting everyone who may look at the data to set Notepad or Wordpad, et.al. to a certain font is a leap. I just made a text file that looks great in Courier (width defined characters), good (not great) in Arial, but switch to Times' and it's hosed up. I installed our Reports Toolkit last night with much hesitation, and I'll probably end up using Excel for the "human viewable" report.

-Richard

(p.s. On a side note, if you use the Excel VI's and want to make an EXE, remember to include the proper Dynamic VI's in your build! :headbang: )

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.