Display Problem with Japanese Characters

I retrieve the Japanese row from the Oracle database and display it in the browser. But the characters are displayed in the browser as ???. Insert a Japanese row into the database using the unistr () function.

INSERT INTO MESSAGES (MESSAGE_ID,MESSAGE) VALUES (1,unistr('\0041\0063\0063\0065\0073\0073\0020\004d\0061\006e\0061\0067\0065\006d\0065\006e'));    

I got this in my jvm magazines ISO8859-1when I printed System.getProperty("file.encoding").

select * from v$nls_parameters where parameter in ('NLS_CHARACTERSET')gives UTF8in my db.

Any pointers to how Japanese characters can be displayed correctly?

+3
source share
6 answers

Try changing your browser language. You can do this with Firefox.

+1
source

, , Unicode. SO , Tomcat. , UTF-8, ISO-Latin-1/ISO-8859-1, Latin-1.

Unicode :

  • , ? , Oracle SQL Developer ( Unicode, , ), .
  • JVM ?
  • , , ?

, Unicode ( ) , .

+1

:

  • ( duffymo).
  • ( ). www.yahoo.co.jp - ?
  • , :

unistr ( '\ 0041\0063\0063\0065\0073\0073\0020\004D\0061\006e\0061\0067\0065\006D\0065\006e')

# 3 , .

+1

??? -, / , , . , / Mojibake, . . , Firefox IE ???.

??? : HTTP, . - ?. - , . , ; DB , , .

, , Java -, , JSP/Servlet ( , , , ).

JSP, JSP, servletcontainer :

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

, HTTP-- , :

response.setCharacterEncoding("UTF-8");

. :

0
  • , \0041\0063\0063\0065\0073\0073\0020\004d\0061\006e\0061\0067\0065\006d\0065\006e, , UTF-8 ( "Access Managemen" UTF-8). CHAR, unistr('\306b\307b\3093\3054') ( "にほんご" UTF-8).
  • JDBC NLS_CHARACTERSET DB, , resultSet.getString(2); , .
  • UTF-8 HTML JSP, <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> JSP . JSP - ISO-8859-1 (. https://docs.oracle.com/cd/E17802_01/j2ee/j2ee/1.4/docs/tutorial-update6/doc/WebI18N5.html), .
0

ISO8859-1 UTF-8.

, java.jsp

<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
0

Source: https://habr.com/ru/post/1755879/


All Articles