Bill
Bill

Reputation: 291

Weblogic DB2 data Shows up as '?????' Question Marks

I am running Weblogic 10.3.3 with DB2 z/os and Unicode database, for both my local and development servers.

When I run my application locally, the query to the database returns some of the unicode data as question marks, like this '??? ?? ???????'.

This seems to be happening to the Japanese characters.

However if I deploy the code to the development server the code works fine. I can view the characters in my local browser and they show up.

Has anyone seen this before?

I can not figure out what is different between the servers. The drivers and datasources are identical.

Upvotes: 2

Views: 1301

Answers (2)

Tony Borf
Tony Borf

Reputation: 4660

Yea, I've been there. You need to add,

-Dfile.encoding=UTF-8

to your Weblogic startup script. I found the answer at this blog http://alexrogan.com/?p=126

Upvotes: 2

BalusC
BalusC

Reputation: 1109875

Your code is apparently relying on the platform default encoding when handling the characters. The development server seems to be using UTF-8 while your local development seems to use something different, Windows CP1252 for example, which doesn't support the Japanese characters.

To fix it accordingly, you need to add this to top of every JSP:

<%@ page pageEncoding="UTF-8" %>

Or when you're using Servlets to emit HTML (or other content), then you need to add this before you ever call getWriter()

response.setCharacterEncoding("UTF-8");

Or when you're using JAX-RS (as I see in one of your tags), then you need to append the charset to the @Produces content type.

@Produces("application/xml;charset=UTF-8")

See also:

Upvotes: 0

Related Questions