Afficher un message
Vieux 18/09/2007, 02h51   #7
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Stripping MS Word code from my forms once and for all.

FFMG wrote:
> Sanders Kaufman;92237 Wrote:
>>> No, sorry I was actually talking about some non standard characters
>>> that MS Words inserts.
>>>
>>> Some bowser will, (maybe wrongly), not display any invalid

>> characters
>>> in the textarea itself giving the user the impression that

>> everything
>>> is fine.
>>>
>>> But when I then try to display the comment/entry I get a bunch of
>>> questions marks for the characters that were invalid.

>> Ah, so. You're having a character set problem.
>> Rather than have a big old off-topic thread about it here, you should
>> probably take the question to an Office or HTML group.
>> PHP won't you much.

>
> No I am not, read the question again, carefully this time.
> Textareas of most browsers will, (wrongly), accept MS Word pasted
> code.
>
> By the time it gets to my server I have to clean it up.
> My PHP code must handle it.
>
> Is that on topic enough for you?
>
> FFMG
>
>[/color]

Yes, this has been asked before - but I don't remember what the answer was.

The easiest way would be to check for non-alphanumeric chars using a
regex. If you find any, tell the user to use plain text editor.

You could use a regex to strip non-alphanumeric characters, but this
might have some problems. For instance, what happens if you have a
control sequence which happens to contain a character - i.e. 0x010231?
The 0x42 would be taken as the character '1', even though it's part of a
control sequence. But you could clean it up fairly well this way.

Try googling this newsgroup for something like "MS WORD". It's been a
few months.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
  Réponse avec citation
 
Page generated in 0,05490 seconds with 9 queries