Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

ASCII Codes and 8-bit characters

LEGEND ,
Apr 18, 2007 Apr 18, 2007
I'm pasting content copied from Microsoft Word documents into an update
form, and would like to strip things like curly quotes and exotic bullets,
and replace them with their 7-bit equivalent characters.

I found this PHP function -

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");
}

which looks like the ticket, but it's missing the curly quotes. How could I
pick those guys up, too?

--
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
==================



TOPICS
Server side applications
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 18, 2007 Apr 18, 2007
On 18 Apr 2007 in macromedia.dreamweaver.appdev, Murray *ACE* wrote:

> which looks like the ticket, but it's missing the curly quotes. How
> could I pick those guys up, too?

Curly double quotes are \x93 and \x94. Single right-quote is \x92; by
extension, single left-quote is \x91. You have all of them in that
function; what are you missing?

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 18, 2007 Apr 18, 2007
Hmm - my content still contains 'box' characters after being passed through
that filter!

I'll have to mount a test page to try it out...

Thanks, Joe.

--
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
==================


"Joe Makowiec" <makowiec@invalid.invalid> wrote in message
news:Xns9916BF4982C21makowiecatnycapdotrE@216.104.212.96...
> On 18 Apr 2007 in macromedia.dreamweaver.appdev, Murray *ACE* wrote:
>
>> which looks like the ticket, but it's missing the curly quotes. How
>> could I pick those guys up, too?
>
> Curly double quotes are \x93 and \x94. Single right-quote is \x92; by
> extension, single left-quote is \x91. You have all of them in that
> function; what are you missing?
>
> --
> Joe Makowiec
> http://makowiec.net/
> Email: http://makowiec.net/contact.php


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 18, 2007 Apr 18, 2007
On 18 Apr 2007 in macromedia.dreamweaver.appdev, Murray *ACE* wrote:

> Hmm - my content still contains 'box' characters after being passed
> through that filter!
>
> I'll have to mount a test page to try it out...

Can you post a .doc with examples of the problem characters? I don't use
Word, so I had to go through sample files that correspondents had gifted
me with.

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/contact.php
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 19, 2007 Apr 19, 2007
I can see that this is looking like <gasp>OPERATOR ERROR</gasp>. But if
that proves NOT to be the case, I'll give you a test document! 8)

Thanks, Joe....

--
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
==================


"Joe Makowiec" <makowiec@invalid.invalid> wrote in message
news:Xns9916EA565D98AmakowiecatnycapdotrE@216.104.212.96...
> On 18 Apr 2007 in macromedia.dreamweaver.appdev, Murray *ACE* wrote:
>
>> Hmm - my content still contains 'box' characters after being passed
>> through that filter!
>>
>> I'll have to mount a test page to try it out...
>
> Can you post a .doc with examples of the problem characters? I don't use
> Word, so I had to go through sample files that correspondents had gifted
> me with.
>
> --
> Joe Makowiec
> http://makowiec.net/
> Email: http://makowiec.net/contact.php


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 19, 2007 Apr 19, 2007
Murray,

Open the page in an editor that displays in hexadecimal format. You can
send me the page if you don't have one.

Randy
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 19, 2007 Apr 19, 2007
Thanks, Randy. What do you use?

Here's the page I have -

http://208.112.39.191/xcontent-test.php

Please try pasting a paragraph containing 'curly quotes' into that textarea.
When you submit, the page will be redrawn with the processed content above
the textarea. The demicrosoftizer doesn't seem to be properly trapping
them! 8(

--
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
==================


"Randy Edmunds" <redmunds_nospam@adobe.com> wrote in message
news:f089md$jp5$1@forums.macromedia.com...
> Murray,
>
> Open the page in an editor that displays in hexadecimal format. You can
> send me the page if you don't have one.
>
> Randy


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 19, 2007 Apr 19, 2007
> What (binary editor) do you use?

Visual Studio

> Here's the page I have -
>
> http://208.112.39.191/xcontent-test.php
>
> Please try pasting a paragraph containing 'curly quotes' into that textarea.
> When you submit, the page will be redrawn with the processed content above
> the textarea. The demicrosoftizer doesn't seem to be properly trapping
> them! 8(

When I put in 2 chars: open double curly (x93) and close double curly
(x94), your page spits out x3f x94. When I save this, I am warned that I
now have unicode (and need to change encoding to preserve it).

So, that script detects the open curly, but not the close curly, and the
output is not what you expect. Maybe a PHP expert can help with that code.

Randy

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 19, 2007 Apr 19, 2007
LATEST
Yeah - I'm in the process of stumping one right now! This is nasty indeed!

--
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
==================


"Randy Edmunds" <redmunds_nospam@adobe.com> wrote in message
news:f08nuc$86t$1@forums.macromedia.com...
>> What (binary editor) do you use?
>
> Visual Studio
>
>> Here's the page I have -
>>
>> http://208.112.39.191/xcontent-test.php
>>
>> Please try pasting a paragraph containing 'curly quotes' into that
>> textarea. When you submit, the page will be redrawn with the processed
>> content above the textarea. The demicrosoftizer doesn't seem to be
>> properly trapping them! 8(
>
> When I put in 2 chars: open double curly (x93) and close double curly
> (x94), your page spits out x3f x94. When I save this, I am warned that I
> now have unicode (and need to change encoding to preserve it).
>
> So, that script detects the open curly, but not the close curly, and the
> output is not what you expect. Maybe a PHP expert can help with that code.
>
> Randy
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines