• 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

Postgres JDBC encoding...

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello! Can somebody help me to resolve the following issue? Thanks.

I have the text file. Its encoding is ISO-8859-1. How did I know this? I opened the file in my Firefox and looked at the menu Web developer-> Character Encoding.
In Firefox I see the following string in the file: "aaaébbb".
I read this file in Java program using the following code:

When I print strLine in my Eclipse console I see this string: "aaaГ©bbb". Eclipse console is configured to show in Cp1251 encoding.
I have Postgres 9.0 database and the same string in it. When I select it via pgAdmin I see the same as in Eclipse console.
Now I need to read this string from file and to select from DB via JDBC using this string in WHERE clause.
But my select returns zero result.
When I change my sql from "WHERE field='"+strLine+"'" to "WHERE field LIKE 'aaa__bbb'" result is fine.

How can I use my string from file for correct select via JDBC? Thanks for any help.
 
reply
    Bookmark Topic Watch Topic
  • New Topic