EasyCFM.COM ColdFusion Forums / Other / Punctuation being replaced with ?'s

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Punctuation being replaced with ?'s

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

dln170
07-31-2007 @ 11:13 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 26
Joined: Feb 2007

I have a plain text form that seems to occasionally replace punctuation (like ' . ! etc) with a question mark (?).  

For example someone (probably) copied and pasted the following into the form:

posses an associate?s

I am using a plain text form, nothing special, and PostgreSQL database.  

Any ideas on why this might be happening?  I am thinking it is probably when someone copies and pastes out of word and maybe they have formatted text or something.  Haven't done a lot of experimenting...I will if I get around to it.

Thanks!



This message was edited by dln170 on 8-6-07 @ 10:51 AM

dlackey
07-31-2007 @ 11:29 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

You'll need to replace characters in your action page or check your page encoding type.

Cheers,
Chip

dln170
08-06-2007 @ 10:50 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 26
Joined: Feb 2007

I used REReplace which works except for one major problem:

If a word document contained bulleted text, the bullets are being replaced by a quote " and I can't seem to get those out of there.  Is there any way to do any of the following:

1. If a bullet is found in the form, display a warning that says no bulleted text allowed.

2. Preserve the bulleted text as is with line breaks etc but not allow question marks or quotes to be in there.

Thanks for the help!  

<cfcontent type=...> did not seem to work with a form.





This message was edited by dln170 on 8-6-07 @ 10:51 AM

dlackey
08-06-2007 @ 10:56 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

Can you disable pasting?  Meaning can you prohibit the right mouse click or the depressing of the ctrl key so users don't paste text?  

Otherwise, you may have to use a complex regular expression.  I used to have one in my arsenal and I'll see if I can find it.

Cheers,
Chip

This message was edited by dlackey on 8-6-07 @ 10:56 AM

dln170
08-06-2007 @ 11:00 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 26
Joined: Feb 2007

I will try to look into disabling pasting but that might not be the best solution as it will become obnoxious for my users to have to always retype everything...but it is one idea.  If you find your complex regular expression let me know or if anyone else has ideas...

Meanwhile I'll look into disabling pasting but I don't think I will be allowed to use that approach.

<a href="http://www.jfcstaffing.com">http://www.jfcstaffing.com</a>

dln170
08-06-2007 @ 3:07 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 26
Joined: Feb 2007

I haven't found anything that works for this.

Again the problem occurs with basically the apostrophe and the bullet and dash turning into a ? when going into my PostgreSQL database.

Any help would be greatly appreciated.  I've tried HTMLCode/EditFormat, REReplace to no avail, and experimented with different charsets in the accept-charset portion of the textarea tag.  I've also tried using <cfcontent type=...> to no avail.

If anyone has ever had the problem when people copy and paste from Word please let me know how you resolved.

dlackey
08-06-2007 @ 4:33 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

Sorry for the delay, I thought I had already posted this...  I'm not sure if it will work for your application but it is something we use:

the variable content is the form.value...

<cfscript>
content = Replace(content, chr(8217), chr(39));
content = Replace(content, chr(8216), chr(39));
content = Replace(content, chr(8220), chr(34));
content = Replace(content, chr(8221), chr(34));
content = Replace(content, chr(8211), "-");
content = Replace(content, Chr(10), "", "all");
content = Replace(content, Chr(13), "", "all");  </cfscript>


Cheers,
Chip

This message was edited by dlackey on 8-6-07 @ 4:33 PM

dln170
08-14-2007 @ 9:49 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 26
Joined: Feb 2007

Can't say whether or not this would work because I am apparently not that good with cfscript yet.  

It didn't really seem to do anything however.

dlackey
08-14-2007 @ 10:16 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

Another idea I had is on DynamicDrive.com using a WYSIWYG editor.  You could implement that into your form.  It gives a very similar functionality of what you see here on the forums when entering text (bold, italics, underline, etc).  You could also implement TinyMCE which is opensource, if I recall correctly.  



Cheers,
Chip

This message was edited by dlackey on 8-14-07 @ 10:16 AM


Website Designed and Developed by Pablo Varando.