[openrtm-commit:02430] r676 - trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/util

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 2月 11日 (土) 12:34:58 JST


Author: ga
Date: 2017-02-11 12:34:58 +0900 (Sat, 11 Feb 2017)
New Revision: 676

Modified:
   trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/util/FileUtil.java
Log:
Modified the character code of the generation codes. #3898

Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/util/FileUtil.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/util/FileUtil.java	2017-02-11 02:42:53 UTC (rev 675)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/util/FileUtil.java	2017-02-11 03:34:58 UTC (rev 676)
@@ -102,7 +102,12 @@
 			result = new StringBuffer();
             String ch;
             String sep = System.getProperty("line.separator");
+            boolean firstLine = true;
             while ((ch = br.readLine() ) != null) {
+            	if (firstLine) {
+            		ch = removeUTF8BOM(ch);
+                    firstLine = false;
+                }            	
             	result.append(ch + sep);
             }
             br.close();
@@ -115,6 +120,14 @@
 		return result == null ? null : result.toString();
 	}
 	
+	private static String removeUTF8BOM(String s) {
+		String UTF8_BOM = "\uFEFF";		
+        if (s.startsWith(UTF8_BOM)) {
+            s = s.substring(1);
+        }
+        return s;
+    }
+	
 	/**
 	 * バックアップファイルの整理を行う
 	 * 



More information about the openrtm-commit mailing list