Commit e70df7c2 by andrewlewis Committed by Oliver Woodman

Use UTF-8 everywhere

UTF-8 is the default charset on Android so this should be a no-op change, but
makes the code portable (in case it runs on another platform).

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=167011583
parent 219ad8a7
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
*/ */
package com.google.android.exoplayer2.util; package com.google.android.exoplayer2.util;
import com.google.android.exoplayer2.C;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.charset.Charset; import java.nio.charset.Charset;
...@@ -428,7 +429,7 @@ public final class ParsableByteArray { ...@@ -428,7 +429,7 @@ public final class ParsableByteArray {
* @return The string encoded by the bytes. * @return The string encoded by the bytes.
*/ */
public String readString(int length) { public String readString(int length) {
return readString(length, Charset.defaultCharset()); return readString(length, Charset.forName(C.UTF8_NAME));
} }
/** /**
......
...@@ -253,7 +253,7 @@ public final class Util { ...@@ -253,7 +253,7 @@ public final class Util {
* @return The code points encoding using UTF-8. * @return The code points encoding using UTF-8.
*/ */
public static byte[] getUtf8Bytes(String value) { public static byte[] getUtf8Bytes(String value) {
return value.getBytes(Charset.defaultCharset()); // UTF-8 is the default on Android. return value.getBytes(Charset.forName(C.UTF8_NAME));
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment