Merge change 4555 into donut
* changes: Force UTF-8 encoding for SDK files.
This commit is contained in:
@@ -41,6 +41,11 @@ public final class SdkConstants {
|
||||
*/
|
||||
public final static int CURRENT_PLATFORM = currentPlatform();
|
||||
|
||||
/**
|
||||
* Charset for the ini file handled by the SDK.
|
||||
*/
|
||||
public final static String INI_CHARSET = "UTF-8";
|
||||
|
||||
/** An SDK Project's AndroidManifest.xml file */
|
||||
public static final String FN_ANDROID_MANIFEST_XML= "AndroidManifest.xml";
|
||||
/** An SDK Project's build.xml file */
|
||||
|
||||
@@ -606,7 +606,7 @@ public final class SdkManager {
|
||||
|
||||
|
||||
/**
|
||||
* Parses a property file and returns
|
||||
* Parses a property file (using UTF-8 encoding) and returns
|
||||
* @param buildProp the property file to parse
|
||||
* @param log the ISdkLog object receiving warning/error from the parsing.
|
||||
* @return the map of (key,value) pairs, or null if the parsing failed.
|
||||
@@ -616,7 +616,7 @@ public final class SdkManager {
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
fis = new FileInputStream(buildProp);
|
||||
reader = new BufferedReader(new InputStreamReader(fis));
|
||||
reader = new BufferedReader(new InputStreamReader(fis, SdkConstants.INI_CHARSET));
|
||||
|
||||
String line = null;
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.io.FileWriter;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -1041,7 +1042,7 @@ public final class AvdManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a .ini file from a set of properties.
|
||||
* Writes a .ini file from a set of properties, using UTF-8 encoding.
|
||||
*
|
||||
* @param iniFile The file to generate.
|
||||
* @param values THe properties to place in the ini file.
|
||||
@@ -1049,7 +1050,8 @@ public final class AvdManager {
|
||||
*/
|
||||
private static void writeIniFile(File iniFile, Map<String, String> values)
|
||||
throws IOException {
|
||||
FileWriter writer = new FileWriter(iniFile);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(iniFile),
|
||||
SdkConstants.INI_CHARSET);
|
||||
|
||||
for (Entry<String, String> entry : values.entrySet()) {
|
||||
writer.write(String.format("%1$s=%2$s\n", entry.getKey(), entry.getValue()));
|
||||
|
||||
@@ -17,11 +17,14 @@
|
||||
package com.android.sdklib.internal.project;
|
||||
|
||||
import com.android.sdklib.IAndroidTarget;
|
||||
import com.android.sdklib.SdkConstants;
|
||||
import com.android.sdklib.SdkManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@@ -224,13 +227,14 @@ public final class ProjectProperties {
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the property file.
|
||||
* Saves the property file, using UTF-8 encoding.
|
||||
* @throws IOException
|
||||
*/
|
||||
public void save() throws IOException {
|
||||
File toSave = new File(mProjectFolderOsPath, mType.mFilename);
|
||||
|
||||
FileWriter writer = new FileWriter(toSave);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(toSave),
|
||||
SdkConstants.INI_CHARSET);
|
||||
|
||||
// write the header
|
||||
writer.write(mType.mHeader);
|
||||
|
||||
Reference in New Issue
Block a user