Weblogic DB2 数据显示为“??????”问号
我正在为我的本地服务器和开发服务器运行带有 DB2 z/os 和 Unicode 数据库的 Weblogic 10.3.3。
当我在本地运行应用程序时,对数据库的查询会返回一些 unicode 数据作为问号,例如“???” ?? ??????'。
这似乎发生在日本角色身上。
但是,如果我将代码部署到开发服务器,则代码可以正常工作。我可以在本地浏览器中查看这些字符,它们就会显示出来。
有人见过这个吗?
我无法弄清楚服务器之间有什么不同。驱动程序和数据源是相同的。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,我去过那里。您需要将,添加
到您的Weblogic启动脚本中。我在这个博客http://alexrogan.com/?p=126找到了答案
Yea, I've been there. You need to add,
to your Weblogic startup script. I found the answer at this blog http://alexrogan.com/?p=126
您的代码在处理字符时显然依赖于平台默认编码。开发服务器似乎使用UTF-8,而本地开发似乎使用不同的东西,例如Windows CP1252,它不支持日语字符。
要相应地修复它,您需要将其添加到每个 JSP 的顶部:
或者当您使用 Servlet 发出 HTML(或其他内容)时,您需要在调用
getWriter()
当您使用 JAX-RS (正如我在您的一个标签中看到的那样)时,您需要将
charset
附加到@Produces
内容类型。另请参阅:
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:
Or when you're using Servlets to emit HTML (or other content), then you need to add this before you ever call
getWriter()
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.See also: