Link to home
Start Free TrialLog in
Avatar of Rrugemalira
Rrugemalira

asked on

HOW TO READ FRENCH ALPHABET STRINGS CORRECTLY FROM mySQL database table

CANNOT READ FRENCH ALPHABET WORDS CORRECTLY FROM mySQL database

I'm using JDBC
I have the following lines in my jsp
<%@ page contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@page session="true"%>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>

I am able to deposit french alphabet strings correnctly into a table in mySQL database

When reading, from the table, the deposited string back to another jsp I get ?? instead of the french
alphabet characters.

How do I go about it to correct this?

Please note: with UTF-8 encoding, I'm not able to deposit correctly, french alphabet strings into the database table.
<%@ page contentType="text/html; charset=utf-8" pageEncoding="UTF-8"%>

I do appreciate your instruction.
Avatar of bloodredsun
bloodredsun
Flag of Australia image

Does your mysql have the iso-8859-1 character set installed? If so, is it the character set for the given table?

And does the retrieving JSP also have the correct charset/encoding?

Can you retrieve the french strings correctly when you use a separate java class or servlet?
Avatar of Rrugemalira
Rrugemalira

ASKER

mysql> show variables  gives me:
character_set: latin1
character_sets: latin1 big5 cp1251 cp1257 croat czech danish  dec8 dos estonia euc_kr gb2312
gbk german1 greek hebrew hp8 hungarian koi8_ru k oi8_ukr latin2 latin5 swe7
usa7 win1250 win1251 win1251ukr ujis sjis tis620

I'm assuming French is covered under latin1. I'm not sure latin1 is iso-8859-1 is it?
The retrieving JSP is set with:
<%@ page contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
ASKER CERTIFIED SOLUTION
Avatar of bloodredsun
bloodredsun
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
DHandler servlet retrieves  data from database and outputs french strings wrong! i..e, ??? instead of special french characters.
System.out.println("french_string:", theString); results in ??? where special french characters are supposed to be.
And of course, if I pass theString to a session object to be displayed on a JSP, the display contains ???.  
bloodredsun. I did not understand your last statement: "If they work then it may be an issue with your servlet container".
I meant that if the other two worked and the jsp didn't then tomcat's default encoding may be at fault.

A servlet doesn't work so have you tried to connect from a standalone java class, so that it doesn't depend on the servlet container.
Agreed