Jim Baker avatar Jim Baker committed d4f645a

Added directionality mapping

Comments (0)

Files changed (2)


         self.assertRaises(TypeError, self.db.category, u'xx')
     def test_bidirectional(self):
-        self.assertEqual(self.db.bidirectional(u'\uFFFE'), '')
+        self.assertEqual(self.db.bidirectional(u'\uFFFE'), 'BN')  # CORRECTED according to ICU4J
         self.assertEqual(self.db.bidirectional(u' '), 'WS')
         self.assertEqual(self.db.bidirectional(u'A'), 'L')
         self.assertEqual(self.db.bidirectional(u'\U00020000'), 'L')


 _dir = {
-    # FIXME add more here!
-    ECharacterDirection.BOUNDARY_NEUTRAL: "", #"BN",
-    ECharacterDirection.DIRECTIONALITY_LEFT_TO_RIGHT: "L",
+    ECharacterDirection.ARABIC_NUMBER: "An",
+    ECharacterDirection.BLOCK_SEPARATOR: "B",
+    ECharacterDirection.BOUNDARY_NEUTRAL: "BN",
+    ECharacterDirection.COMMON_NUMBER_SEPARATOR: "CS",
+    ECharacterDirection.DIR_NON_SPACING_MARK: "NSM",
+    ECharacterDirection.EUROPEAN_NUMBER: "EN",
+    ECharacterDirection.EUROPEAN_NUMBER_SEPARATOR: "ES",
+    ECharacterDirection.EUROPEAN_NUMBER_TERMINATOR: "ET",
+    ECharacterDirection.FIRST_STRONG_ISOLATE: "FSI",
+    ECharacterDirection.LEFT_TO_RIGHT: "L",
+    ECharacterDirection.LEFT_TO_RIGHT_EMBEDDING: "LRE",
+    ECharacterDirection.LEFT_TO_RIGHT_ISOLATE: "LRI",
+    ECharacterDirection.LEFT_TO_RIGHT_OVERRIDE: "LRO",
+    ECharacterDirection.OTHER_NEUTRAL: "ON",
+    ECharacterDirection.POP_DIRECTIONAL_FORMAT: "PDF",
+    ECharacterDirection.POP_DIRECTIONAL_ISOLATE: "PDI",
+    ECharacterDirection.RIGHT_TO_LEFT: "R",
+    ECharacterDirection.RIGHT_TO_LEFT_ARABIC: "AL",
+    ECharacterDirection.RIGHT_TO_LEFT_EMBEDDING: "RLE",
+    ECharacterDirection.RIGHT_TO_LEFT_ISOLATE: "RLI",
+    ECharacterDirection.RIGHT_TO_LEFT_OVERRIDE: "RLO",
+    ECharacterDirection.SEGMENT_SEPARATOR: "S",
+    ECharacterDirection.WHITE_SPACE_NEUTRAL: "WS"
 def bidirectional(unichr):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.