On Fri, 23 Jul 1999 02:30:19 +0100, Arnd Hanses wrote:

Add to LString.C:

>+/* SMiyata: bitwise AND 0x7f a string is more efficient than subst();
>+** ISO-8859-x and EUC (Extended Unix Code) works just fine with this.
>+** The only remaining problem is that Microsoft/IBM codepages, 
>+** Shift-JIS and Big5 utilizes the region 0x80-0x9f which will be 
>+** converted to non-printable control characters. 
>+*/
>+LString& LString::toAsciiPrintable()
>+{
>+        for (int i=0; i<length(); i++) {
>+              p->s[i] &= 0x7f;
>+              p->s[i] |= 0x20; /* bad idea! */
>+      }
>+        return *this;
>+}

Please consider the bitwise OR 32 (p->s[i] |= 0x20;) just as an
indication that I've run out of imagination; a per char test not to
cross the 127 boundary would be very time consuming:

+               p->s[i] &= 0x7f;
+               !(isprint(p->s[i])) ? (p->s[i] |= 0x20) : ; /* ? */



 I'd like a safe and *efficient* method for conversion to printable
ASCII. Steal such a thing from somewhere to use it with class LString?

Or: Let's make this unnecessary and always assign unique and LaTeX-safe
random 7-bit file names to all TeX output.

Heeelp,

        Arnd


Reply via email to