From 04342f2b7653fa4fd3e3c26f82d9ac8c3dc14d36 Mon Sep 17 00:00:00 2001 From: Oliver Woodman Date: Thu, 10 Sep 2015 18:31:08 +0100 Subject: [PATCH] Don't use toLowerCase :). It can do weird things if the device has an unusual default Locale. Util.toLowerInvariant uses the US Locale, which does the right thing in this case. --- .../google/android/exoplayer/text/ttml/TtmlParser.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlParser.java b/library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlParser.java index a087657495..1a7617a577 100644 --- a/library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlParser.java +++ b/library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlParser.java @@ -21,6 +21,7 @@ import com.google.android.exoplayer.text.Subtitle; import com.google.android.exoplayer.text.SubtitleParser; import com.google.android.exoplayer.util.MimeTypes; import com.google.android.exoplayer.util.ParserUtil; +import com.google.android.exoplayer.util.Util; import android.graphics.Color; import android.text.Layout; @@ -224,14 +225,14 @@ public final class TtmlParser implements SubtitleParser { break; case TtmlNode.ATTR_TTS_FONT_WEIGHT: style = createIfNull(style).setBold( - TtmlNode.BOLD.equals(attributeValue.toLowerCase())); + TtmlNode.BOLD.equalsIgnoreCase(attributeValue)); break; case TtmlNode.ATTR_TTS_FONT_STYLE: style = createIfNull(style).setItalic( - TtmlNode.ITALIC.equals(attributeValue.toLowerCase())); + TtmlNode.ITALIC.equalsIgnoreCase(attributeValue)); break; case TtmlNode.ATTR_TTS_TEXT_ALIGN: - switch (attributeValue.toLowerCase()) { + switch (Util.toLowerInvariant(attributeValue)) { case TtmlNode.LEFT: style = createIfNull(style).setTextAlign(Layout.Alignment.ALIGN_NORMAL); break; @@ -250,7 +251,7 @@ public final class TtmlParser implements SubtitleParser { } break; case TtmlNode.ATTR_TTS_TEXT_DECORATION: - switch (attributeValue.toLowerCase()) { + switch (Util.toLowerInvariant(attributeValue)) { case TtmlNode.LINETHROUGH: style = createIfNull(style).setLinethrough(true); break;