You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/07/16 12:24:07 UTC

[commons-imaging] 02/02: Use a JRE built-in Charset instead of a magic string

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git

commit 539e27b422415816b51fe39727a1ec934e37b2b6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Jul 16 08:24:00 2023 -0400

    Use a JRE built-in Charset instead of a magic string
---
 .../commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java
index 426b7c1c..e383c9dc 100644
--- a/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java
+++ b/src/main/java/org/apache/commons/imaging/formats/tiff/taginfos/TagInfoGpsText.java
@@ -48,20 +48,20 @@ public final class TagInfoGpsText extends TagInfo {
 
     private static final TagInfoGpsText.TextEncoding TEXT_ENCODING_ASCII = new TextEncoding(
             new byte[] { 0x41, 0x53, 0x43, 0x49, 0x49, 0x00, 0x00, 0x00, },
-            "US-ASCII"); // ITU-T T.50 IA5
+            StandardCharsets.US_ASCII.name()); // ITU-T T.50 IA5
     private static final TagInfoGpsText.TextEncoding TEXT_ENCODING_JIS = new TextEncoding(
             new byte[] { 0x4A, 0x49, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, },
             "JIS"); // JIS X208-1990
     private static final TagInfoGpsText.TextEncoding TEXT_ENCODING_UNICODE_LE = new TextEncoding(
             new byte[] { 0x55, 0x4E, 0x49, 0x43, 0x4F, 0x44, 0x45, 0x00},
-            "UTF-16LE"); // Unicode Standard
+            StandardCharsets.UTF_16LE.name()); // Unicode Standard
     private static final TagInfoGpsText.TextEncoding TEXT_ENCODING_UNICODE_BE = new TextEncoding(
             new byte[] { 0x55, 0x4E, 0x49, 0x43, 0x4F, 0x44, 0x45, 0x00},
-            "UTF-16BE"); // Unicode Standard
+            StandardCharsets.UTF_16BE.name()); // Unicode Standard
     private static final TagInfoGpsText.TextEncoding TEXT_ENCODING_UNDEFINED = new TextEncoding(
             new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
             // Try to interpret an undefined text as ISO-8859-1 (Latin)
-            "ISO-8859-1"); // Undefined
+            StandardCharsets.ISO_8859_1.name()); // Undefined
 
     private static final TagInfoGpsText.TextEncoding[] TEXT_ENCODINGS = {
             TEXT_ENCODING_ASCII, //