Go Back   Java Programming Forums > Java EE (Enterprise Edition) > JavaServer Pages: JSP & JSTL


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-11-2008, 06:43 AM
Junior Member
 

Join Date: Nov 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
vaishali is on a distinguished road
Default How to add marathi words to mysql table

Hi...
I am working on project related to localization.I want to add marathi text to mysql table.But when i add it through jsp page it shows garbage values.Can u suggest any solution to this problem.
Thank you.




Last edited by vaishali; 12-11-2008 at 06:48 AM.
Reply With Quote Share this thread on Facebook
Sponsored Links
Java Training from DevelopIntelligence
  #2 (permalink)  
Old 12-11-2008, 12:12 PM
JavaPF's Avatar
mmm.. coffee
 
7 Highscores

Join Date: May 2008
Location: United Kingdom
Posts: 1,583
Thanks: 104
Thanked 93 Times in 86 Posts
JavaPF is someone you want to know!JavaPF is someone you want to know!JavaPF is someone you want to know!

I'm feeling Mellow
Default Re: How to add marathi words to mysql table

Hello vaishali.

Welcome to the Java Programming Forums.

Can you please post the code that you have written.
It will be near impossible to diagnose your problem without it..

Thanks.
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight]

Forum Tip: Add to peoples reputation () by clicking the button on their useful posts.
Reply With Quote
  #3 (permalink)  
Old 13-11-2008, 04:29 AM
Junior Member
 

Join Date: Nov 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
vaishali is on a distinguished road
Default Re: How to add marathi words to mysql table

Hi...
Thanks for reply.Actually i am using java,mysql database with netbeans 6.1.Whenever i try to add through command editor it will add values correctly.But whenever i add it through program it will shows '??' marks instead of values.
Below i am pasting the code which i had used.

Java code to insert values.I have used jsp page for that.

Java Code
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page language="java" import="java.sql.*,java.util.Enumeration" import="java.sql.Connection" %>
<html>
<head>
<title>Test</title>
 
</head>
<body>
 
<%
String url="jdbc:mysql://localhost:3306/MyNewDatabase";
Connection con = null;
Statement stmt;
ResultSet rs = null;
String query,query1;
PreparedStatement stmt1;
 
try{
 
 
try{
 
Class.forName("com.mysql.jdbc.Driver");
}
catch(Exception e)
{
out.println("driver_not_found"+e.getMessage());
}
 
con = DriverManager.getConnection (url,"root","mysql123");
 
int id1=1115;
String word1="आई";
String pos1="noun";
 
stmt1=con.prepareStatement("insert into htb_all_words1 values('"+id1 +"','"+word1+"','"+pos1+"')");
stmt1.executeUpdate();
 
 
stmt = con.createStatement();
query = "select * from htb_all_words1 ";
ResultSet result = stmt.executeQuery(query);
 
while(result.next())
{
String id= result.getString(1);
 
String word2=result.getString(2);
 
String pos2=result.getString(3);
 
%>
<br><% out.println(id);%>
 
<% out.println(word2);%>
<% out.println(pos2);%>
 
 
<% 
}
}
catch(Exception e)
{
out.println("SQLException_caught:_" + e.getMessage());
}
 
finally {
try {
if (con != null) con.close();
}
catch (SQLException e) {}
 
} 
 
%> 
<br>
Second JSP page...................
</body>
</html>
THIS IS THE OUTPUT I AM GETTING

Java Code
 
 
!-- Document : keyboard Created on : Sep 16, 2008, 10:24:59 PM Author : staff --> 
1 धन verb 
2 पुण verb 
3 पुण verb 
10 पुण verb 
11 ?? noun 
99 शोध noun 
100 पुण verb 
111 905 noun 
112 u0905 noun 
113 905 noun 
114 905 noun 
115 u0905 noun 
116 \u0905 noun 
1000 ?? verb 
1001 पुण noun 
1002 †œ noun 
1003 †œ noun 
1004 धन verb 
1111 ?? noun 
1113 ?? noun 
1114 आई noun 
1115 ?? noun 
Second JSP page...................
Reply With Quote
  #4 (permalink)  
Old 08-07-2009, 11:43 AM
Json's Avatar
Super Moderator
 

Join Date: Jul 2009
Location: Manchester, United Kingdom
Posts: 1,188
Thanks: 57
Thanked 137 Times in 133 Posts
Json will become famous soon enoughJson will become famous soon enoughJson will become famous soon enough

I'm feeling Happy
Default Re: How to add marathi words to mysql table

This sounds like a classical UTF-8 madness issue, you need to make sure your database accepts UTF-8 as well, have you had a look in it to see what the data is actually like?

After that you need to make sure the JSP page is actually set to use the correct character set so that the website is sent to the browser as UTF-8. You could have a look at content type for this.

Last thing to do might be to check your servlet container and make sure it is set up to deliver and handle UTF-8.


// Json
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic table creation jam123 JavaServer Pages: JSP & JSTL 2 08-07-2009 11:35 AM
Getting table height jsnx7 JavaServer Pages: JSP & JSTL 1 19-03-2009 04:03 PM
MySQL+Java+Unicode Desert Fox JDBC & Databases 2 12-11-2008 12:29 PM


100 most searched terms
Search Cloud
2d arraylist java actionlistener actionlistener in java actionlistener java addactionlistener addactionlistener in java addactionlistener java applications of oops could not create java virtual machine xp double format java double to int java double to integer in java double to integer java eclipse shortcut keys eclipse tutorial for beginners exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double java get mouse position java http://www.javaprogrammingforums.com/object-oriented-programming/3713-limiting-decimal-places-double.html java 2d arraylist java actionlistener java addactionlistener java double format java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programmers forum java programming forum java programming forums java programming help java project ideas java sendkeys java two dimensional arraylist java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton actionlistener jtextarea font jtextarea font color jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream two dimensional arraylist java writing ipod apps

All times are GMT. The time now is 11:32 PM.
Powered by vBulletin Copyright 2000-2009, Jelsoft Enterprises Ltd.