By Chris Malek | 28 February 2012
Removing MS Word Smart quotes in PeopleSoft Pages
How to get rid of those upside down question marks.
When you have pages that allow for a user to copy and paste into long fields, you may later see upside down question marks or other strange non-printable characters. This only applies if your PeopleSoft database is not setup for unicode. Microsoft Word uses something called “smart quotes” that are slightly different characters for single and double quotes. If you look closely, the begin quote is angled to the right and the end quote is angled to the left. When a PeopleSoft user tries to paste in some text, the smart quotes will get pasted in to the browser window but PeopleSoft cannot handle it. At some point in the application stack, these smart quotes are getting converted to upside down question marks or some other strange looking character.
I came up with a solution on how to fix this. You have to fix it in the user’s web browser before it gets submitted to the PeopleSoft web and application server layers because it is converted there. I did some testing and the smart quotes are getting converted to non-printable before it gets to the peoplecode processor. Therefore, you can’t solve the issue with PeopleCode.
The smart quote removal fix that I came up with has the following components.
- An HTML area on the page to hold the function above.
I have created a simple page that will isolate just the pieces we need. Here is a screenshot that shows a simple page that has a long comment box and two HTML areas on the page which are tied to derived fields.
GetLevel0()(1).CHG_WORK.HTMLAREA1.Value = GetHTMLText(HTML.CHG_REMOVE_SMARTQUOTE); /* The "COMMENTBOX" string passed as parameter matches the page field name that is being observed. */ GetLevel0()(1).CHG_WORK.HTMLAREA2.Value = GetHTMLText(HTML.CHG_SMARTQUOTE_ADD_OBSERVER, "COMMENTBOX");
The contents of
HTML.CHG_REMOVE_SMARTQUOTE looks like the following code. This holds the
The contents of
The end result is that every time a user changes the value of the comment box the