summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorsri-vidyut <srividyut@hotmail.com>2021-07-28 02:29:42 +0900
committerGitHub <noreply@github.com>2021-07-27 17:29:42 +0000
commit8e1febc6a1e909eeb4334d5572956f669ee2d290 (patch)
treeebdf8521585d22567cf12dc1784bcf9288a39d6b /tests
parentFix `oldest_pdu_in_federation_staging` (#10455) (diff)
downloadsynapse-8e1febc6a1e909eeb4334d5572956f669ee2d290.tar.xz
Support underscores (in addition to hyphens) for charset detection. (#10410)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_preview.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_preview.py b/tests/test_preview.py
index cac3d81ac1..48e792b55b 100644
--- a/tests/test_preview.py
+++ b/tests/test_preview.py
@@ -325,6 +325,19 @@ class MediaEncodingTestCase(unittest.TestCase):
         )
         self.assertEqual(encoding, "ascii")
 
+    def test_meta_charset_underscores(self):
+        """A character encoding contains underscore."""
+        encoding = get_html_media_encoding(
+            b"""
+        <html>
+        <head><meta charset="Shift_JIS">
+        </head>
+        </html>
+        """,
+            "text/html",
+        )
+        self.assertEqual(encoding, "Shift_JIS")
+
     def test_xml_encoding(self):
         """A character encoding is found via the meta tag."""
         encoding = get_html_media_encoding(