Skip to main content
Inspiring
February 25, 2007
Question

Can I strip the 8th bit from character data?

  • February 25, 2007
  • 3 replies
  • 374 views
I am wanting to display articles copied from Word into a web interface.
These characters may contain ASCII codes for high-order bits, like curly
quotes, etc. Can I just strip those bits before displaying the articles, so
that the characters display normally?

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================



This topic has been closed for replies.

3 replies

Inspiring
February 25, 2007
Murray *ACE* wrote:
> I need to do this on the fly

Well, why didn't you say so in the first place? :-/

> - but I found an answer on (where else?) the
> PHP.NET site! 8)

It's a brilliant resource, as is Google.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Inspiring
February 25, 2007
I need to do this on the fly - but I found an answer on (where else?) the
PHP.NET site! 8)

function demicrosoftize($str) {
return strtr($str,
"\x82\x83\x84\x85\x86\x87\x89\x8a" .
"\x8b\x8c\x8e\x91\x92\x93\x94\x95" .
"\x96\x97\x98\x99\x9a\x9b\x9c\x9e\x9f",
"'f\".**^\xa6<\xbc\xb4''" .
"\"\"---~ \xa8>\xbd\xb8\xbe");
}

and it seems to work quite well!

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:ersgo7$er3$1@forums.macromedia.com...
> Murray *ACE* wrote:
>> I am wanting to display articles copied from Word into a web interface.
>> These characters may contain ASCII codes for high-order bits, like curly
>> quotes, etc. Can I just strip those bits before displaying the articles,
>> so that the characters display normally?
>
> To get rid of curly quotes in Word, go to Tools > Auto-Correct Options and
> select the AutoFormat As You Type tab. Deselect "Straight quotes" with
> "smart quotes". Then do a Find and Replace operation, replacing a single
> quote with a single quote and a double quote with a double quote.
>
> --
> David Powers, Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> Author, "PHP Solutions" (friends of ED)
> http://foundationphp.com/


Inspiring
February 25, 2007
Murray *ACE* wrote:
> I am wanting to display articles copied from Word into a web interface.
> These characters may contain ASCII codes for high-order bits, like curly
> quotes, etc. Can I just strip those bits before displaying the articles, so
> that the characters display normally?

To get rid of curly quotes in Word, go to Tools > Auto-Correct Options
and select the AutoFormat As You Type tab. Deselect "Straight quotes"
with "smart quotes". Then do a Find and Replace operation, replacing a
single quote with a single quote and a double quote with a double quote.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/