Author Topic: AutoCAD Character Codes In Text String  (Read 1347 times)

0 Members and 1 Guest are viewing this topic.

absStructural

  • Guest
AutoCAD Character Codes In Text String
« on: November 23, 2013, 10:20:31 AM »
I'm experiencing some inconsistent behavior with text (normal text, mtext, text in a table) and character codes.  I'll provide some examples of what I'm seeing... and hopefully someone can help me to understand what's going on.

We use a customized shx font that has custom characters from character 181 to 195.   So, when entering the first of these, a user would typically type %%181 as the text value, and AutoCAD displays the correct shx character.  This works in normal text, but not in mtext or in a table.  With mtext or a table, I can copy and paste character 181 (for instance) - which looks like [ ] - and the correct shx character will show up.  Likewise, the user can hold alt, type 0181, then release alt, and the correct character will show up.

Ok, so - you're probably wondering why I am writing this in the .NET forum.  Well, here is where some code comes in.

With normal text, I can set DBText.TextString = "%%181".  This will display the correct character.  If I then retrieve the text again - string myText = DBText.TextString), the value is as expected - "%%181".

BUT

If a user types "%%181" in a piece of text, and then I read the piece of text, the value is character 181.  This was not the case in AutoCAD 2006, where TextString would still reflect "%%181" - behavior that (to me) made sense, because it was consistent.

All of this becomes a problem when programmatically parsing text.  Sometimes it has %%[character code], and sometimes it has the character.

Can someone please shed some light on this?