This week's book giveaways are in the Cloud and AI/ML forums.
We're giving away four copies each of Cloud Native Patterns and Natural Language Processing and have the authors on-line!
See this thread and this one for details.
Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

windows word double quotes turning into boxes

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Marshal
Posts: 67273
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ]
 
Prakash Gorthy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!