aspose file tools*
The moose likes JDBC and the fly likes Can i save Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Can i save "தமிழ்" in Database assuch" Watch "Can i save "தமிழ்" in Database assuch" New topic
Author

Can i save "தமிழ்" in Database assuch

Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
Hi,

In my application i am entering a Tamil charater as "தமிழ்" and in debug mode i can see the variable some thing as "&#2224 &#2224 &#2224 &#2224 " and when it saves in Database it saves in the same format. However when it displays again browser it displays correctly in Tamil as "தமிழ்".

However they wants that to be saved in the database as exactly what we entered in Tamil "தமிழ்". can we store the exact Tamil character as such in database like this "தமிழ்"..

My JSP pages has a page encoding as UTF-8 and with valid META Tag. Also in my server i am setting request content type as UTF-8

<%@ page language="java" import="com.obopay.wap.common.*" pageEncoding="UTF-8"%>

<META http-equiv="Content-Type" content="text/html;charset=UTF-8">

request.setCharacterEncoding("UTF-8");


I really appreciate if you guys can throw some lights on this. thank you so much


My Thoughts : http://passion4java.blogspot.com
Try not to become a man of success but rather to become a man of value.
Charbel Keyrouz
Ranch Hand

Joined: Jun 10, 2005
Posts: 46
Make sure the character encoding in your database is set to UTF-8 otherwise you won't succeed in saving these letters.

UTF-8 should be in jsp pages and database.
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
in all my JSP i have set pageEncoding as "UTF-8" and i don't know how can i set in database as UTF-8 format....


Even after setting "UTF-8" in JSP why can't i see the தமிழ் as such in my debug variable....

is there any conversion which i have to do using String object by converting using byte Array???
Charbel Keyrouz
Ranch Hand

Joined: Jun 10, 2005
Posts: 46
Which database you are using?
MySQL, Oracle, etc...
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18114
    
    8

It seems to me that if you write that character to the database and then read it back, and you get the same character back, that's all you really need. A lot of people would be overjoyed if they could just have that. You don't need to interfere with the way the database stores it -- what difference does it make anyway? And you don't really need to worry about how your debugger displays it, either; there may be various reasons why it can't render that character naturally, but since it's being handled correctly that's really a minor problem in my opinion.
Charbel Keyrouz
Ranch Hand

Joined: Jun 10, 2005
Posts: 46
What if the databases stores it as rubbish character.

In order to simply store it and read it the same way, the database should have the same character set to which this string's characters belong.
Kamalnath Balakrishnan
Greenhorn

Joined: Mar 22, 2011
Posts: 2
Charbel Keyrouz wrote:What if the databases stores it as rubbish character.

In order to simply store it and read it the same way, the database should have the same character set to which this string's characters belong.




I am going to write Tamil name to enter database:

kk.jsp
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html:text name="updateForm" property="tamilName" bundle="default" />

In Action.java
if(request.getCharacterEncoding() == null)
request.setCharacterEncoding("UTF-8");
String enameT=request.getParameter("tamilName");



When it Prints in Action like ==>மனோகர்


Kindly give the Solution
...........Thanks in advance......
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1476
    
  11

The answer to your question is: yes, you can save Tamil characters (or any others) in the database.

Here is some background stuff on multilingual database support in Oracle, for example. Talk to your DBA to make sure your Java client/middleware is using the same character encoding etc as the database.


No more Blub for me, thank you, Vicar.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can i save "தமிழ்" in Database assuch
 
Similar Threads
Java Internationalization Issue for Arabic
Validate
cannot use utf-8 to store utf-8 character, please help
Auto form submit with parameter from URL not working in IE
Need to get utf-8 strings in java servlet