mirror of
https://github.com/androidx/media.git
synced 2025-05-05 06:30:24 +08:00
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
This commit is contained in:
parent
219ad8a73e
commit
e70df7c220
@ -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 {
|
|||||||
* @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 {
|
|||||||
* @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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user