7 Replies Latest reply on Mar 15, 2004 10:50 PM by 702619

    请教大家pageflow中文问题

    702619
      为什么我的pageflow下的jsp通过form bean传递的变量,凡是中文的全是???????,jsp页面中也改过字符集了。
      <%@pagelanguage="java"contentType="text/html;charset=gb2312"%>
      请高手指点
        • 1. Re: 请教大家pageflow中文问题
          702619
          hi,limiao

          I am not sure what is the correct answer for your quetion.
          But you can try this solution ,if your platform is english version.

          Perhaps the workshop cannot display the Chinese character in the English version. So you must configure the parameters in it.
          -----Tool->IDEproperties->Display->select window font: dialog, size=12->select source view font: dialogInput, size=12->ok->restart weblogic workshop
          If it cannot display Chinese characters after step 15, you can try to reboot the machine.

          tanks
          • 2. Re: 请教大家pageflow中文问题
            702619
            这都是由于java runtime environment和中文字体之间的细小问题导致的,也并不是说java不支持中文(但其Sun的开发人员没有做过严格的测试,使基于J2EE的所有开发都有中文中题)。

            在这里我说明所有关于J2EE的开发中的中文问题,都可以按我下面的方式解决。
            方法:
            在安装基于J2EE的开发工具后,都会有jre(java runtime environment)这个目录。[如:安装了BEA的weblogic8.1(假设安装在C盘),就会是"C:\bea\jdk141_03\jre"。如安装了JBuilder9(假设安装在C盘),就会有"C:\JBuilder9\jdk1.4\jre"]。在"jre"的目录下面有个叫"lib"的目录,只要修改"jre\lib"目录中"font.properties.zh"文件的内容就可以解决所有的J2EE开发的中文问题。
            具体的修改内容(font.properties.zh)如下:
            # ====================== 开 始 =========================
            # Copyright 2002 HNEC, Inc. All rights reserved.
            # 修改:刘猛
            # 日期:2002年12月1日
            # 用途:为Java 支持中文显示的配置

            # Component Font Mappings
            #
            dialog.plain.0=Arial,ANSI_CHARSET
            dialog.plain.1=\u5b8b\u4f53,GB2312_CHARSET
            dialog.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            dialog.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            dialog.bold.0=Arial Bold,ANSI_CHARSET
            dialog.bold.1=\u5b8b\u4f53,GB2312_CHARSET
            dialog.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            dialog.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            dialog.italic.0=Arial Italic,ANSI_CHARSET
            dialog.italic.1=\u5b8b\u4f53,GB2312_CHARSET
            dialog.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            dialog.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            dialog.bolditalic.0=Arial Bold Italic,ANSI_CHARSET
            dialog.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
            dialog.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            dialog.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            dialoginput.plain.0=Courier New,ANSI_CHARSET
            dialoginput.plain.1=\u5b8b\u4f53,GB2312_CHARSET
            dialoginput.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            dialoginput.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            dialoginput.bold.0=Courier New Bold,ANSI_CHARSET
            dialoginput.bold.1=\u5b8b\u4f53,GB2312_CHARSET
            dialoginput.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            dialoginput.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            dialoginput.italic.0=Courier New Italic,ANSI_CHARSET
            dialoginput.italic.1=\u5b8b\u4f53,GB2312_CHARSET
            dialoginput.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            dialoginput.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            dialoginput.bolditalic.0=Courier New Bold Italic,ANSI_CHARSET
            dialoginput.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
            dialoginput.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            dialoginput.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            serif.plain.0=Times New Roman,ANSI_CHARSET
            serif.plain.1=\u5b8b\u4f53,GB2312_CHARSET
            serif.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            serif.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            serif.bold.0=Times New Roman Bold,ANSI_CHARSET
            serif.bold.1=\u5b8b\u4f53,GB2312_CHARSET
            serif.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            serif.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            serif.italic.0=Times New Roman Italic,ANSI_CHARSET
            serif.italic.1=\u5b8b\u4f53,GB2312_CHARSET
            serif.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            serif.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            serif.bolditalic.0=Times New Roman Bold Italic,ANSI_CHARSET
            serif.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
            serif.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            serif.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            sansserif.plain.0=Arial,ANSI_CHARSET
            sansserif.plain.1=\u5b8b\u4f53,GB2312_CHARSET
            sansserif.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            sansserif.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            sansserif.bold.0=Arial Bold,ANSI_CHARSET
            sansserif.bold.1=\u5b8b\u4f53,GB2312_CHARSET
            sansserif.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            sansserif.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            sansserif.italic.0=Arial Italic,ANSI_CHARSET
            sansserif.italic.1=\u5b8b\u4f53,GB2312_CHARSET
            sansserif.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            sansserif.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            sansserif.bolditalic.0=Arial Bold Italic,ANSI_CHARSET
            sansserif.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
            sansserif.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            sansserif.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            monospaced.plain.0=\u5b8b\u4f53,GB2312_CHARSET
            monospaced.plain.1=\u5b8b\u4f53,GB2312_CHARSET
            monospaced.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            monospaced.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            monospaced.bold.0=\u5b8b\u4f53,GB2312_CHARSET
            monospaced.bold.1=\u5b8b\u4f53,GB2312_CHARSET
            monospaced.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            monospaced.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            monospaced.italic.0=\u5b8b\u4f53,GB2312_CHARSET
            monospaced.italic.1=\u5b8b\u4f53,GB2312_CHARSET
            monospaced.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            monospaced.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            monospaced.bolditalic.0=\u5b8b\u4f53,GB2312_CHARSET
            monospaced.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
            monospaced.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
            monospaced.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

            # Font File Names
            #
            filename.\u5b8b\u4f53=SIMSUN.TTC

            filename.Arial=ARIAL.TTF
            filename.Arial_Bold=ARIALBD.TTF
            filename.Arial_Italic=ARIALI.TTF
            filename.Arial_Bold_Italic=ARIALBI.TTF

            filename.Courier_New=COUR.TTF
            filename.Courier_New_Bold=COURBD.TTF
            filename.Courier_New_Italic=COURI.TTF
            filename.Courier_New_Bold_Italic=COURBI.TTF

            filename.Times_New_Roman=TIMES.TTF
            filename.Times_New_Roman_Bold=TIMESBD.TTF
            filename.Times_New_Roman_Italic=TIMESI.TTF
            filename.Times_New_Roman_Bold_Italic=TIMESBI.TTF

            filename.WingDings=WINGDING.TTF
            filename.Symbol=SYMBOL.TTF

            # Missing Glyph Character
            #
            default.char=2751

            # Component Font Character Encodings
            #
            fontcharset.dialog.1=sun.io.CharToByteGBK
            fontcharset.dialog.2=sun.awt.windows.CharToByteWingDings
            fontcharset.dialog.3=sun.awt.CharToByteSymbol

            fontcharset.dialoginput.1=sun.io.CharToByteGBK
            fontcharset.dialoginput.2=sun.awt.windows.CharToByteWingDings
            fontcharset.dialoginput.3=sun.awt.CharToByteSymbol

            fontcharset.serif.1=sun.io.CharToByteGBK
            fontcharset.serif.2=sun.awt.windows.CharToByteWingDings
            fontcharset.serif.3=sun.awt.CharToByteSymbol

            fontcharset.sansserif.1=sun.io.CharToByteGBK
            fontcharset.sansserif.2=sun.awt.windows.CharToByteWingDings
            fontcharset.sansserif.3=sun.awt.CharToByteSymbol

            fontcharset.monospaced.0=sun.io.CharToByteGBK
            fontcharset.monospaced.1=sun.io.CharToByteGBK
            fontcharset.monospaced.2=sun.awt.windows.CharToByteWingDings
            fontcharset.monospaced.3=sun.awt.CharToByteSymbol

            # Exclusion Ranges
            #
            exclusion.dialog.0=0100-20ab,20ad-f8ff
            exclusion.dialoginput.0=0100-20ab,20ad-f8ff
            exclusion.serif.0=0100-20ab,20ad-f8ff
            exclusion.sansserif.0=0100-20ab,20ad-f8ff
            exclusion.monospaced.0=0100-20ab,20ad-f8ff

            # Text Input Character Set
            #
            inputtextcharset=GB2312_CHARSET

            # ====================== 结 束 =========================

            该帖由 khit 在 2003-12-20 上午11:11 编辑过

            该帖由 khit 在 2003-12-20 上午11:12 编辑过
            • 3. 几点经验, 功参考.
              702619
              1)在startweblogic.cmd 文件中添加如下代码(使程序编译时按gb2312编码):

              %JAVA_OPTIONS% -Dfile.encoding=gb2312;


              2)修改weblogic.xml文件(使页面向服务器发送的内容按gb2312编码):

              ……
              <jsp-param>
              <param-name>encoding</param-name>
              <param-value>gb2312</param-value>
              </jsp-param>
              ……


              3)修改web.xml文件(使页面之间通过URL方式传递的中文参数以gb2312进行编码):

              ……
              <context-param>
              <param-name>weblogic.httpd.inputCharset./*</param-name>
              <param-value>gb2312</param-value>
              </context-param>
              ……


              4)修改 .portal文件(使portal运行时采用gb2312字符集):

              <portal:directive.page contentType="text/html;charset=gb2312"/>


              5)每个jsp的文件头里面都写上如下的语句(使每个页面都采用gb2312字符集):

              <%@ page language="java" contentType="text/html;charset=gb2312"%>


              6)如果仍然出现乱码,可再对该乱码字符串使用如下方法进行一次编码方式的转换:

              NewString = new String( OldString.getBytes(), "gb2312" );
              • 4. Re: 请教大家pageflow中文问题
                702619
                等我测试一下。
                • 5. Re: 请教大家pageflow中文问题
                  702619
                  应该和ide没关系.使用jdk1.4.2试试 ,好运
                  • 6. Re: 请教大家pageflow中文问题
                    702619
                    关注!!!
                    • 7. Re: 请教大家pageflow中文问题
                      702619
                      不错,收藏,回去试试!