aspose file tools*
The moose likes JSP and the fly likes windows word double quotes turning into boxes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "windows word double quotes turning into boxes" Watch "windows word double quotes turning into boxes" New topic
Author

windows word double quotes turning into boxes

Prakash Gorthy
Greenhorn

Joined: Jul 10, 2003
Posts: 9
Hi,
I have a form that has a text area where users can paste content or type in. I have set content type in the page directive as :
so that I receive text without funny characters (like ? etc) when users paste content from MSWord also. The pageEncoding and contentType setting are working fine for characters like bullets etc but failing for double quotes and turning into boxex when I display the text back to the browser. I am not sure about doing anything more.
Any help is greatly appreciated.
Regards
Prakash
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
Sounds like those damn Microsoft "smart quotes" are at it again. Man! I hate those things. You are going to have to replace the "smart quotes" with legal quote characters before echoing the text back. Unfortunately I can't remember what the hex values are so you are going to have to dump all the characters of an example string as hex (or decimal) to find out.
Bill
Manish Sharma
Greenhorn

Joined: Apr 11, 2003
Posts: 10
Hi Prakash
Actually i could'nt understand yr problem , can you send your jsp code or some details
Manish Sharma
Originally posted by Prakash Gorthy:
Hi,
I have a form that has a text area where users can paste content or type in. I have set content type in the page directive as :
so that I receive text without funny characters (like ? etc) when users paste content from MSWord also. The pageEncoding and contentType setting are working fine for characters like bullets etc but failing for double quotes and turning into boxex when I display the text back to the browser. I am not sure about doing anything more.
Any help is greatly appreciated.
Regards
Prakash
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61432
    
  67

Actually i could'nt [sic] understand yr [sic] problem , can you send your jsp code or some details

Not necessary as William has already completely addressed the problem.
bear
P.S. 3 jobs ago I was bitten by this when a tech writer wrote all the help content in Word, and then the text was cut-and-pasted into the JSP pages. Finding all those nasty "smart" characters was a pain in the royal derriere. And at the time we were using JRun whose JSP parser barfed its guts out when it encountered one of these. What good family fun!
[ July 10, 2003: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Prakash Gorthy
Greenhorn

Joined: Jul 10, 2003
Posts: 9
Here is the sample code of the jsp i am using. Currently i am searching for the hex values of the "smart quotes" of word.
If any one can point me to them it will be a great help.
Regards
Prakash

(My actual use is to store the entire content into mysql database and later on show it up when user request it.
I am mimiking the database writing and reading using streams.)
Prakash Gorthy
Greenhorn

Joined: Jul 10, 2003
Posts: 9
After a small check to see the int values of these ms word fancy characters i found out that the smart quote values are 8220,8221.
Instead of conveting the text I am receiving from request parameter to uft-8, i am now calling a small bean which accepts a string looks for smart quotes and smart dashes and replaces them with normal quotes and dashes.
here is the method I am using but wondering is this the only way or any other better way?

Note: when list items in word document are pasted they as well turn up to be boxes with int value 61623 (getting displayed as ?) which i am ignoring at this moment.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: windows word double quotes turning into boxes