I am trying to fetch records from Oracle 9i database whose value are 'FOO - BAR' for a particular column.
The 'FOO - BAR' condition values are present in the table, But when I run the query, the results are not coming.
After breaking my head for sometime, figured out that there is a difference in the size of the hypen's.
'FOO – BAR'
'FOO - BAR'
This time I copied (through SQLDeveloper) the DB value and pasted the value in Eclipse IDE. I did NOT see any difference in the Eclipse. When I run the query from IDE, to my surprise it worked and the values were coming.
I deployed the same class file to our servers(UX box), and again back to square no 1 - the values are not coming.
I gave a try changing the file encoding of my IDE from default(Cp1252) to UTF-8 and everything is fine now.
Can some one explain what's happening? Will the size of hyphen varies with encoding? do we have three different kinds of dashes?
There are plenty of different Unicode characters for em-dash, en-dash, hyphen etc. They're used in different contexts in text.
You may want to read the "Dash" wikipedia article for more information. Note that a hyphen isn't quite the same thing :)
As for how encodings come into things - it will depend on how you're inserting, retrieving and then displaying the data. I wouldn't start using cut and paste - that may very well try to find the closest available value to the actual data represented in the database.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With