Sign in to follow this  
benryves

DOS extended ASCII characters to RTF (also: MS Word's space issue)

Recommended Posts

I'm writing a DOOM WAD viewer (Visual Basic .NET). One resource it can view and extract are the DOS exit screens, which are 4000 bytes (80x25 res, 2000 pairs of colour info then character ASCII code). The format that it exports to (and internally converts to to display) is RTF. However, there are certain characters in the DOS extended ASCII that do not match up with those in Windows, which I currently escape with \u#?, getting the Unicode character code from a lookup (not good). Is there is a way that you can convert a DOS ascii code number to a Unicode code number, through a function? (Or do I stick with that unsightly LUT?) The other issue is that MS Word seems to have problems with the RTF files I export. write.exe and the VB.NET RichTextBox control have not got this issue - that if the end of a line is padded with spaces (with the row highlighted in a colour) then Word ignores it and leaves the end of the row blank (white), which looks silly. Is there a way around this, or do I just accept that Word is weird? (I'm highlighting lines with \highlight#).

Share this post


Link to post
Share on other sites
If you don't mind a bit of P/Invoke, then you can use the MultiByteToWideChar function, passing the MB_USEGLYPHCHARS flag will convert those extra characters to their Unicode equivalents.

Unfortunately, that flag is a bit useless, since it only converts those extended characters (!) I think your current mapping table is probably just as good (and I don't think a P/Invoke would make it much faster).

For your other problem, I don't know :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this