• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Retrieving data from database

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 "
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic