把中文用下面函数转换一下。
string test="你好";
byte[] temp=test.getBytes("ISO8859-1");
test=new String(temp);

解决方案 »

  1.   

    你在linux下用的是windows下的TrueType字体吗?
    其他Linux下的应用程序可以显示中文吗?
      

  2.   

    我在Linux下,可以输出中文,我得java应用程序的各窗口的标题也是中文。就是菜单,标签都是乱码……
      

  3.   

    你的LANG怎么设置的?你的ResourceBundle用native2ascii处理过了,应该不用转码了,我想不是java的问题,应该是Linux的设置问题。
      

  4.   

    输出前定义
    res.setContentType("text/html;charset=GBK");
      

  5.   

    我也觉得现在的问题不在是java的问题了,应该是linux的设置问题了;
    我的linux是阳春白雪redhat7.2,一般来说都有中文字体的吧,比如-isas song ti-……我用xlsfonts |grep gb可以找到系统里有这个字体,但是他的类似ttf的字体库在哪里阿?我linux不熟悉……唉,我想找到他的字体库,用export JAVA_FONTS=……试一下……
      

  6.   

    Font f = new Font(UIResource.getString("Default_font"),Font.PLAIN,12);
          UIManager.put("Label.font",f);
          UIManager.put("Label.foreground",Color.black);
          UIManager.put("Button.font",f);
          UIManager.put("Menu.font",f);
          UIManager.put("MenuItem.font",f);
          UIManager.put("List.font",f);
          UIManager.put("CheckBox.font",f);
          UIManager.put("RadioButton.font",f);
          UIManager.put("ComboBox.font",f);
          UIManager.put("TextArea.font",f);
    Font f = new Font("隶书",Font.PLAIN,15);
               UIManager.put("Button.font",font);
      UIManager.put("ToggleButton.font",font);
      UIManager.put("RadioButton.font",font);
      UIManager.put("CheckBox.font",font);
      UIManager.put("ColorChooser.font",font);
      UIManager.put("ToggleButton.font",font);
      UIManager.put("ComboBox.font",font);
      UIManager.put("ComboBoxItem.font",font);
      UIManager.put("InternalFrame.titleFont",font);
      UIManager.put("Label.font",font);
      UIManager.put("List.font",font);
      UIManager.put("MenuBar.font",font);
      UIManager.put("Menu.font",font);
      UIManager.put("MenuItem.font",font);
      UIManager.put("RadioButtonMenuItem.font",font);
      UIManager.put("CheckBoxMenuItem.font",font);
      UIManager.put("PopupMenu.font",font);
      UIManager.put("OptionPane.font",font);
      UIManager.put("Panel.font",font);
      UIManager.put("ProgressBar.font",font);
      UIManager.put("ScrollPane.font",font);
      UIManager.put("Viewport",font);
      UIManager.put("TabbedPane.font",font);
      UIManager.put("TableHeader.font",font);
      UIManager.put("TextField.font",font);
      UIManager.put("PasswordFiled.font",font);
      UIManager.put("TextArea.font",font);
      UIManager.put("TextPane.font",font);
      UIManager.put("EditorPane.font",font);
      UIManager.put("TitledBorder.font",font);
      UIManager.put("ToolBar.font",font);
      UIManager.put("ToolTip.font",font);
      UIManager.put("Tree.font",font);
      

  7.   

    你的Linux中有SimSun字体吗?
    用TrueType汉化Linux说起来很麻烦,你可以去网上查一下,有很多,比如www.linuxforum.net。wjmmml(笑着悲伤) 说的也有道理,你试试改一下字体先。
      

  8.   

    输出前定义
    res.setContentType("text/html;charset=GBK");打印是也进行转换吧:
    string test="测试";
    byte[] temp=test.getBytes("ISO8859-1");
    test=new String(temp,"GBK");
    ----------------------------------------
    ==================================================================
    注意:此人因发表爱国言论,被斑竹hexiaofen*扣除6分信誉分,问你死未?!*****************************************************************
      

  9.   

    但是同样的程序,只是我用JButton的时候就没有中文问题,用Button的时候就不行……