[geary/wip/362-utf8-attachments: 7/8] Minor code tidy-up



commit 536120ac0bd6af907c1fdfc22c2278dfd277f89c
Author: Michael Gratton <mike vee net>
Date:   Fri Jul 19 20:52:04 2019 +1000

    Minor code tidy-up

 src/engine/rfc822/rfc822-part.vala | 13 -------------
 src/engine/rfc822/rfc822.vala      | 21 ++++++++++++++++++++-
 2 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/src/engine/rfc822/rfc822-part.vala b/src/engine/rfc822/rfc822-part.vala
index 55ef0496..d81e6a7c 100644
--- a/src/engine/rfc822/rfc822-part.vala
+++ b/src/engine/rfc822/rfc822-part.vala
@@ -237,16 +237,3 @@ public class Geary.RFC822.Part : Object {
     }
 
 }
-
-private inline bool is_utf_8(string charset) {
-    string up = charset.up();
-    return (
-        // ASCII is a subset of UTF-8, so it's also valid
-        up == "ASCII" ||
-        up == "US-ASCII" ||
-        up == "US_ASCII" ||
-        up == "UTF-8" ||
-        up == "UTF8" ||
-        up == "UTF_8"
-    );
-}
diff --git a/src/engine/rfc822/rfc822.vala b/src/engine/rfc822/rfc822.vala
index 1c05dc9f..9195eac1 100644
--- a/src/engine/rfc822/rfc822.vala
+++ b/src/engine/rfc822/rfc822.vala
@@ -15,10 +15,15 @@ public enum TextFormat {
 }
 
 /**
- * Official IANA charset encoding name for UTF-8.
+ * Official IANA charset encoding name for the UTF-8 character set.
  */
 public const string UTF8_CHARSET = "UTF-8";
 
+/**
+ * Official IANA charset encoding name for the ASCII  character set.
+ */
+public const string ASCII_CHARSET = "US-ASCII";
+
 private int init_count = 0;
 
 internal Regex? invalid_filename_character_re = null;
@@ -47,4 +52,18 @@ public void init() {
     }
 }
 
+
+internal bool is_utf_8(string charset) {
+    string up = charset.up();
+    return (
+        // ASCII is a subset of UTF-8, so it's also valid
+        up == "ASCII" ||
+        up == "US-ASCII" ||
+        up == "US_ASCII" ||
+        up == "UTF-8" ||
+        up == "UTF8" ||
+        up == "UTF_8"
+    );
+}
+
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]