text encoding gotcha?

Alex Rice alex at mindlube.com
Tue Jan 13 12:33:33 EST 2004


This appears to be related to the other bug I posted about recently: 
trouble after copy-pasting from Excel. Why the heck is Revolution 
accepting wide and or control characters when I paste into the IDE? 
This is bad. I am supposed to deliver an app today (yesterday actually) 
and instead I have to manually go through and reset the content of 
many, many fields.

Here is some debugging from the message box to show how bizarre this is.

 > put fld 4
T h e   f a c i l i t y   h a s   t y p i c a l   v i s i t o r  
 f a c i l i t y   f u n c t i o n s ,   b u t   w i l l   a l s o  
 b e   a   h u b   f o r   m u l t i p l e   m o d e s   o f  
 t r a n s p o r t a t i o n   r e q u i r i n g   b u s ,  
 t r a i n ,   a n d / o r   b o a t   f a c i l i t i e s .     A n  
 e x a m p l e   o f   t h i s   t y p e   o f   f a c i l i t y   i s  
 t h e   Z i o n   N a t i o n a l   P a r k   V i s i t o r  
 C e n t e r . 

 > put the length of fld 4
475

 > put safeString(fld 4)
The facility has typical visitor facility functions, but will also be a 
hub for multiple modes of transportation requiring bus, train, and/or 
boat facilities.  An example of this type of facility is the Zion 
National Park Visitor Center.

-- It appears to be the same text, right? Wrong!
 > put the length of safeString(fld 4)
238

That it is 1/2 the length corresponds to what I am seeing on Win32- 
every other character is a box- "unknown" char.

function safeString pStr
   -- 011 octal = tab
   -- 012 octal = newline (in transcript "return", "linefeed")
   -- 040 - 167 = space to "~"
   -- ignore 177+ assume they won't cause problems
   return replaceText(pStr, "([\000-\010]|[\013-\037])+", empty)
end safeString


Alex Rice <alex at mindlube.com> | Mindlube Software | 
<http://mindlube.com>

what a waste of thumbs that are opposable
to make machines that are disposable  -Ani DiFranco



More information about the use-livecode mailing list