473,513 Members | 2,562 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Oracle returns ¿ instead of unicode characters

dzenanz
45 New Member
Java insert proc:
Expand|Select|Wrap|Line Numbers
  1. storedProc = conn.prepareCall("{call SMSC.p_smsu_campaign_insert(?,?,?,?,?,?)}");
  2. storedProc.setString("Campaign_name", campaign);
  3. storedProc.setString("Used_OA", OA);
  4. storedProc.setInt("RefNum", 1);
  5. storedProc.setString("Send_Start", df.format(new java.sql.Date(startSend)));
  6. storedProc.setString("Last_VP", df.format(new java.sql.Date(EndDate.getTime() + validity_period)));
  7. storedProc.setString("Created", df.format(new java.sql.Date(System.currentTimeMillis())));
  8. storedProc.execute();
DB insert proc:
Expand|Select|Wrap|Line Numbers
  1. create or replace procedure P_SMSU_CAMPAIGN_INSERT (
  2. Campaign_name in nchar,
  3. Used_OA in char,
  4. RefNum in number:=1,
  5. Last_VP in char,
  6. Send_Start in char,
  7. Created in char
  8. ) is
  9. begin
  10.   insert into Campaigns (Campaign_name, Used_OA, RefNum, Last_VP, Send_Start, Created)
  11.   values (Campaign_name, Used_OA, RefNum, 
  12.   to_date(Last_VP, 'YYYY-MM-DD HH24:MI:SS'),
  13.   to_date(Send_Start, 'YYYY-MM-DD HH24:MI:SS'),
  14.   to_date(Created, 'YYYY-MM-DD HH24:MI:SS')
  15.   );
  16. end P_SMSU_CAMPAIGN_INSERT;
DB table:
Expand|Select|Wrap|Line Numbers
  1. create table CAMPAIGNS
  2. (
  3.   CAMPAIGN_NAME NVARCHAR2(100) not null,
  4.   USED_OA       CHAR(67),
  5.   REFNUM        NUMBER not null,
  6.   LAST_VP       DATE not null,
  7.   SEND_START    DATE not null,
  8.   CREATED       DATE default sysdate not null
  9. )
DB select proc:
Expand|Select|Wrap|Line Numbers
  1. create or replace procedure P_SMSU_BULK_SUMMARY_STATUS
  2. (
  3.     RCT1 OUT    GLOBALPKG.RCT1,
  4.         ReportTimestamp in Timestamp:=null
  5. ) is
  6.  
  7. begin
  8.   open rct1 for
  9.   SELECT c.campaign_name, c.used_oa, c.created, c.send_start, c.last_vp
  10.   FROM CAMPAIGNS C
  11.     where (ReportTimestamp between c.created and c.last_vp) or ReportTimestamp is null;
  12. end P_SMSU_BULK_SUMMARY_STATUS;
java fetch:
Expand|Select|Wrap|Line Numbers
  1. storedProc = conn.prepareCall("{call SMSC.P_SMSU_BULK_SUMMARY_STATUS(?,?)}");
  2. storedProc.registerOutParameter("RCT1", OracleTypes.CURSOR);
  3. storedProc.setTimestamp("ReportTimestamp", forTime);
  4. storedProc.execute();
  5. ResultSet result = (ResultSet) storedProc.getObject("RCT1");
  6. return ResultSupport.toResult(result);
java display:
Expand|Select|Wrap|Line Numbers
  1. Object[][] rows = fetch().getRowsByIndex();
  2. for (int i = 0; i < rows.length; i++)
  3. {
  4.     out.println("<tr>");
  5.     for (int k = 0; k < rows[i].length; k++)
  6.         out.println("<td>" + encodeHTML(rows[i][k].toString()) + "</td>");
  7.     out.println("</tr>");
  8. }
and in the campaign name column I get "¿etvrti test ¿¿¿¿¿ ¿¿¿¿¿" instead of "četvrti test šđčćž ŠĐČĆŽ" (which I entered). Function encodeHTML gets crap as parameter, so html encoding is not the problem.

Platform ojdbc1.4 + oracle10g. What am I doing wrong?
Apr 15 '08 #1
3 2166
JosAH
11,448 Recognized Expert MVP
and in the campaign name column I get "¿etvrti test ¿¿¿¿¿ ¿¿¿¿¿" instead of "četvrti test šđčćž ŠĐČĆŽ" (which I entered). Function encodeHTML gets crap as parameter, so html encoding is not the problem.

Platform ojdbc1.4 + oracle10g. What am I doing wrong?
The ASCII characters come through fine. My guess is that the font you're using
can't display the glyphs (shape) of the non-ASCII characters. Try the Arial MS
Unicode font (if you have it installed) for starters.

kind regards,

Jos
Apr 15 '08 #2
dzenanz
45 New Member
It is not that. When I check the received string in the debugger, it contains crap characters (code point 191), and they get displayed properly (with inverted question mark)
Apr 15 '08 #3
dzenanz
45 New Member
I have rechecked, and crap characters are stored in database, so the insertion part skrews up.

At the statement
Expand|Select|Wrap|Line Numbers
  1. storedProc.setString("Campaign_name", campaign);
variable campaign contains correct string (netbeans debugger displays it correctly).

Also, when I access db from Visual Studio (either direct access to table or through insert procedure), everything is fine!

Java part correctly shows unicode characters inserted/modified by program written in Visual Studio! So, I have narrowed the problem to the insertion part:
Expand|Select|Wrap|Line Numbers
  1. storedProc = conn.prepareCall("{call SMSC.p_smsu_campaign_insert(?,?,?,?,?,?)}");
  2. storedProc.setString("Campaign_name", campaign);
  3. storedProc.setString("Used_OA", OA);
  4. storedProc.setInt("RefNum", 1);
  5. storedProc.setString("Send_Start", df.format(new java.sql.Date(startSend)));
  6. storedProc.setString("Last_VP", df.format(new java.sql.Date(EndDate.getTime() + validity_period)));
  7. storedProc.setString("Created", df.format(new java.sql.Date(System.currentTimeMillis())));
  8. storedProc.execute();
Apr 16 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1641
by: Sudha | last post by:
I have an asp application in asp that should support languages like japanese, french, chinese, malay and english. I am using the characterset as iso-8859-1 in the html meta tag. Most of the characters are getting stored in the unicode format. But there are few characters in french, japanese and chinese that are not getting stored properly....
1
9178
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this will work for 9i and even 10g ) No one had what I needed, so I wrote it myself. I Rule. This code isn't going for efficiency, and isn't trying...
2
4800
by: Ram | last post by:
Hey, I'm trying to execute an Insert SQL command, where one of the parameters I'm trying to insert, has some unicode characters. The execute command gives no error, but when I use Nevigator to see the new line, Alll the unicode characters have been misteryously converted to - "?" !!! I'v tried every known Oracle Provider - ADO 2.7,...
0
1143
by: RobertoP | last post by:
Hello, I am trying to create a simple Oracle application that queries some data from Oracle. The problem is that it randomly returns trailing \0s instead of the characters of a string. Instead of: NIC, returns sometimes as N\0\0 188524C-01, returns somtimes as 18852\0\0\0\0\0
0
1867
by: RobertoP | last post by:
Hello, I am trying to create a simple Oracle application that queries some data from Oracle. The problem is that it randomly returns trailing \0s instead of the characters of a string. Instead of: NIC, returns sometimes as N\0\0 188524C-01, returns somtimes as 18852\0\0\0\0\0
2
2364
by: Ram | last post by:
Hey, I'm using VB.NET and I'm trying to execute SQL Command, Where one of the parameters I'm trying to insert, has some unicode characters. The execute command gives no error, but when I use Nevigator to see the new line, Alll the unicode characters have been misteryously converted to - "?" !!! I'v tried every known Oracle Provider - ADO...
1
3443
by: shaguna.dhall | last post by:
I need to migrate Unicode data from MS Access to Oracle. Have tried the following: -Exported the Access tables to csv/txt, but these files were generated in ANSI encoding, and the Unicode data got converted to ASCII characters. -ODBC export directly to the Oracle tables doesn't work either. -However, when the table is exported to excel,...
2
3533
dzenanz
by: dzenanz | last post by:
Calling a stored procedure from Java with ojdbc 1.4 corrupts (converts to ¿) unicode characters that are not contained in DB's current charset. Calling this proc from C# works as expected (all unicode characters are properly stored). String driver = "oracle.jdbc.OracleDriver"; Class.forName(driver); DriverManager.registerDriver(new...
1
5345
by: Server Applications | last post by:
Hello I am trying to build a system where I can full-text index documents with UTF8 or UTF16 data using Oracle Text. I am doing the filtering in a third-party component outside the database, so the I dont need filtering in Oracle, but only indexing. If I put file references to the filtered files in the database and index these (using...
0
7397
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7565
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5704
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5103
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4759
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3255
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
817
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
473
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.