| 
 | 
 
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册 
 
 
 
×
 
发信人: ioly (anguls), 信区: Java 
标  题: Re: IDEA 3.0正式版 and some java books uploa... 
发信站: BBS 水木清华站 (Thu Nov 14 10:09:36 2002), 转信 
 
对于中文问题有如下看法, 希望能抛砖引玉 
起因: 
  idea3.0实际上对中文支持已经很好, 但是由于其默认charset是utf-8, 
 当你在ide options选择"新宋体"并保存的时候, idea将你的style的信息 
 以xml的格式写到\IntelliJ-IDEA-3.0\config\colors(windows 2000平台), 
 很可惜它写xml的时候使用的是系统默认charset, 这显然是个失误: 
 <?xml version="1.0" encoding="UTF-8"?> 
 <scheme name="style1" parent_scheme="Default"> 
   <option name="LINE_SPACING" value="1.0" /> 
   <option name="EDITOR_FONT_SIZE" value="13" /> 
   <option name="EDITOR_FONT_NAME" value="新宋体"/> 
  三个gb码的"新宋体"显然没有作任何处理. 于是, idea下次启动的时候, 
 使用utf-8 parse这个xml的时候显然无法正确识别字体名. 
解决方法: 
 1, 将那个xml中的"新宋体"三个字的码字转换成"UTF-8"编码. 下面是一个参考 
  转码程序: 
 
- Enc.java
 
 - import java.io.*;
 
 - public class Enc{
 
 -     public static void main(String[] args) throws Exception{
 
 -         if (args.length != 4){
 
 -             System.out.println("usage: java Enc <src file> <src encoding> <t
 
 - arget file> <target encoding>");
 
 -             System.exit(0);
 
 -         }else if (args[0].equals(args[2])){
 
 -             System.out.println("cannot overwrite src file, change the target
 
 -  file name pls.");
 
 -             System.exit(0);
 
 -         }
 
 -         BufferedReader reader = new BufferedReader(new InputStreamReader(new
 
 -  FileInputStream(args[0]), args[1]), 1024 * 1024);
 
 -         BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(ne
 
 - w FileOutputStream(args[2]), args[3]), 1024 * 1024);
 
 -         String line = reader.readLine();
 
 -         while(line != null){
 
 -             writer.write(line);
 
 -             writer.newLine();
 
 -             line = reader.readLine();
 
 -         }
 
 -         reader.close();
 
 -         writer.close();
 
 -     }
 
 - }
 
 
  复制代码 
  转码成功后的xml文件头是这样 
  <?xml version="1.0" encoding="UTF-8"?> 
  <scheme name="style1" parent_scheme="Default"> 
    <option name="LINE_SPACING" value="1.0" /> 
    <option name="EDITOR_FONT_SIZE" value="13" /> 
    <option name="EDITOR_FONT_NAME" value="鏂板畫浣?" /> 
  这里的"新宋体"三个字用的是真正的utf-8编码 
 2, 第二种方法还只属于构思. 就是想办法搞出这样一种字体, 支持汉字显示, 
    但字体名是英文的. 这等于是对idea网开一面. 初步的设想是拷贝一份 
    新宋体的ttc(simsun.ttc), 然后想办法更改其字体名. 这可不仅仅是更改 
    一下文件名就可以的. 不知道ttc文件的结构, 无从下手. 
 
 
【 在 NullPointer (空指针·莫之夭阏) 的大作中提到: 】 
: 建议把Editor Font设为Courier, Size 13 or 12 
 
 
-- 
 
※ 来源:·BBS 水木清华站 smth.edu.cn·[FROM: 218.17.78.152] |   
 
 
 
 |