• Post Reply Bookmark Topic Watch Topic
  • New Topic

Retrieving data from database

 
Felipe Messina
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm with a problem here, that nobody was able to help me.
I don't know JSF, and I got a job in my company to do this.

I'm using JPA for persistence, and JSF.

When I paste some piece of text extracted from a WORD document, the special characters ( - / ? @ $%! " * ) goes to the database different (it's right), BUT when I retrieve this text all the changed characters are not converted to the same as the WORD document, they appears like in database.

Please, someone could help me with this problem?
 
Carlos Conti
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
in your situation I would convert the text to hexadecimal when writting to the db, and from hex to text when reading. This way you will avoid all this problems.
You will easily find examples for hexadecimal text conversion in the internet.

Instead, you could select the datatype BINARY or analogue, for the affected column in your database schema. I was proposed a while ago this solution for backing data from richTextformat controls in JSF. It worked. It can also depend on the framework you are using.

I don't know it these are best solutions, but certainly turning to hexadecimals solves most of the problems at least when serializing files to a database.
Good luck.

Carlos.
 
Felipe Messina
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carlos,

the solutin that you gave me, didn't work.

This tipe o text " Gdd – jhsdjsdhf " pasted from WORD, comes to my screen, when retrieved from database like this " Gdd ¿ jhsdjsdhf "
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to read this article: Character Conversions from Browser to Database.
 
Felipe Messina
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul, I tried what this article is saying to do, but when I put this:



the application throws the following message: Error Traced[line: 5] The markup in the document preceding the root element must be well-formed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!