# Converts Hexadecimal Unicode Codes with the prefix 'U+/u+' in text to Corresponding Characters
## Tested against Windows 10 / Python 3.10 / Anaconda
## pip install unicodekonverter
```python
Converts Hexadecimal Unicode Codes with the prefix 'U+/u+' in text to Corresponding Characters
This function takes a text containing hexadecimal Unicode codes and replaces them with their corresponding
characters. It utilizes a precompiled Trie regex pattern (compiled at the first run) to efficiently
identify and replace the Unicode codes.
Args:
tex (str): The input text containing hexadecimal Unicode codes to be converted.
concurrent (int or None): The number of concurrent threads to use during pattern matching.
If provided, the function will use multiple threads to process the text concurrently.
Set to None (default) to disable concurrent processing.
Returns:
str: The input text with hexadecimal Unicode codes replaced by their corresponding characters.
Example:
text2='''
U+25A0 Black square
U+25A1 White square
U+25A2 White square with rounded corners
U+25A3 White square containing small black square
U+25A4 Square with horizontal fill
U+25A5 Square with vertical fill
U+25A6 Square with orthogonal crosshatch fill
U+25A7 Square with upper left to lower right fill
U+25A8 Square with upper right to lower left fill
U+25A9 Square with diagonal crosshatch fill
U+25AA Black small square
U+25AB White small square
U+25AC Black rectangle
U+25AD White rectangle
U+25AE Black vertical rectangle
U+25AF White vertical rectangle
U+25B0 Black parallelogram
U+25B1 White parallelogram
U+25B2 Black up-pointing triangle
U+25B3 White up-pointing triangle
U+25B4 Black up-pointing small triangle
U+25B5 White up-pointing small triangle
U+25B6 Black right-pointing triangle
U+25B7 White right-pointing triangle
U+25B8 Black right-pointing small triangle
U+25B9 White right-pointing small triangle
U+25BA Black right-pointing pointer
U+25BB White right-pointing pointer
U+25BC Black down-pointing triangle
U+25BD White down-pointing triangle
U+25BE Black down-pointing small triangle
U+25BF White down-pointing small triangle
U+25C0 Black left-pointing triangle
U+25C1 White left-pointing triangle
U+25C2 Black left-pointing small triangle
U+25C3 White left-pointing small triangle
U+25C4 Black left-pointing pointer
U+25C5 White left-pointing pointer
U+25C6 Black diamond
U+25C7 White diamond
U+25C8 White diamond containing small black diamond
U+25C9 Fisheye
U+25CA Lozenge
U+25CB White circle
U+25CC Dotted circle
U+25CD Circle with vertical fill
U+25CE Bullseye
U+25CF Black circle
U+25D0 Circle with left half black
U+25D1 Circle with right half black
U+25D2 Circle with lower half black
U+25D3 Circle with upper half black
U+25D4 Circle with upper right quadrant black
U+25D5 Circle with all but upper left quadrant black
U+25D6 Left half circle black
U+25D7 Right half black circle
U+25D8 Inverse bullet
U+25D9 Inverse white circle
U+25DA Upper half inverse white circle
U+25DB Lower half inverse white circle
U+25DC Upper left quadrant circular arc
U+25DD Upper right quadrant circular arc
U+25DE Lower right quadrant circular arc
U+25DF Lower left quadrant circular arc
U+25E0 Upper half circle
U+25E1 Lower half circle
U+25E2 Black lower right triangle
U+25E3 Black lower left triangle
U+25E4 Black upper left triangle
U+25E5 Black upper right triangle
U+25E6 White bullet
U+25E7 Square with left half black
U+25E8 Square with right half black
U+25E9 Square with upper left diagonal half black
U+25EA Square with lower right diagonal half black
U+25EB White square with vertical bisecting line
U+25EC White up-pointing triangle with dot
U+25ED Up-pointing triangle with left half black
U+25EE Up-pointing triangle with right half black
U+25EF Large circle
U+25F0 White square with upper left quadrant
U+25F1 White square with lower left quadrant
U+25F2 White square with lower right quadrant
U+25F3 White square with upper right quadrant
U+25F4 White circle with upper left quadrant
U+25F5 White circle with lower left quadrant
U+25F6 White circle with lower right quadrant
U+25F7 White circle with upper right quadrant
U+25F8 Upper left triangle
U+25F9 Upper right triangle
U+25FA Lower-left triangle
U+25FB White medium square
U+25FC Black medium square
U+25FD White medium small square
U+25FE Black medium small square
U+25FF Lower right U+25FF triangle
'''
te=convert_2_unicode(text2)
print(te)
output:
■ Black square
□ White square
▢ White square with rounded corners
▣ White square containing small black square
▤ Square with horizontal fill
▥ Square with vertical fill
▦ Square with orthogonal crosshatch fill
▧ Square with upper left to lower right fill
▨ Square with upper right to lower left fill
▩ Square with diagonal crosshatch fill
▪ Black small square
▫ White small square
▬ Black rectangle
▭ White rectangle
▮ Black vertical rectangle
▯ White vertical rectangle
▰ Black parallelogram
▱ White parallelogram
▲ Black up-pointing triangle
△ White up-pointing triangle
▴ Black up-pointing small triangle
▵ White up-pointing small triangle
▶ Black right-pointing triangle
▷ White right-pointing triangle
▸ Black right-pointing small triangle
▹ White right-pointing small triangle
► Black right-pointing pointer
▻ White right-pointing pointer
▼ Black down-pointing triangle
▽ White down-pointing triangle
▾ Black down-pointing small triangle
▿ White down-pointing small triangle
◀ Black left-pointing triangle
◁ White left-pointing triangle
◂ Black left-pointing small triangle
◃ White left-pointing small triangle
◄ Black left-pointing pointer
◅ White left-pointing pointer
◆ Black diamond
◇ White diamond
◈ White diamond containing small black diamond
◉ Fisheye
◊ Lozenge
○ White circle
◌ Dotted circle
◍ Circle with vertical fill
◎ Bullseye
● Black circle
◐ Circle with left half black
◑ Circle with right half black
◒ Circle with lower half black
◓ Circle with upper half black
◔ Circle with upper right quadrant black
◕ Circle with all but upper left quadrant black
◖ Left half circle black
◗ Right half black circle
◘ Inverse bullet
◙ Inverse white circle
◚ Upper half inverse white circle
◛ Lower half inverse white circle
◜ Upper left quadrant circular arc
◝ Upper right quadrant circular arc
◞ Lower right quadrant circular arc
◟ Lower left quadrant circular arc
◠ Upper half circle
◡ Lower half circle
◢ Black lower right triangle
◣ Black lower left triangle
◤ Black upper left triangle
◥ Black upper right triangle
◦ White bullet
◧ Square with left half black
◨ Square with right half black
◩ Square with upper left diagonal half black
◪ Square with lower right diagonal half black
◫ White square with vertical bisecting line
◬ White up-pointing triangle with dot
◭ Up-pointing triangle with left half black
◮ Up-pointing triangle with right half black
◯ Large circle
◰ White square with upper left quadrant
◱ White square with lower left quadrant
◲ White square with lower right quadrant
◳ White square with upper right quadrant
◴ White circle with upper left quadrant
◵ White circle with lower left quadrant
◶ White circle with lower right quadrant
◷ White circle with upper right quadrant
◸ Upper left triangle
◹ Upper right triangle
◺ Lower-left triangle
◻ White medium square
◼ Black medium square
◽ White medium small square
◾ Black medium small square
◿ Lower right ◿ triangle
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/unicodekonverter",
"name": "unicodekonverter",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Convert,unicode,utf-8",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c0/ff/55b4c6c523fdc71ee6f9114e892510515dd976be286c43e46c9f9489db88/unicodekonverter-0.11.tar.gz",
"platform": null,
"description": "\r\n# Converts Hexadecimal Unicode Codes with the prefix 'U+/u+' in text to Corresponding Characters\r\n\r\n## Tested against Windows 10 / Python 3.10 / Anaconda\r\n\r\n## pip install unicodekonverter\r\n\r\n\r\n```python\r\n Converts Hexadecimal Unicode Codes with the prefix 'U+/u+' in text to Corresponding Characters\r\n\r\n This function takes a text containing hexadecimal Unicode codes and replaces them with their corresponding\r\n characters. It utilizes a precompiled Trie regex pattern (compiled at the first run) to efficiently\r\n identify and replace the Unicode codes.\r\n\r\n Args:\r\n tex (str): The input text containing hexadecimal Unicode codes to be converted.\r\n concurrent (int or None): The number of concurrent threads to use during pattern matching.\r\n If provided, the function will use multiple threads to process the text concurrently.\r\n Set to None (default) to disable concurrent processing.\r\n\r\n Returns:\r\n str: The input text with hexadecimal Unicode codes replaced by their corresponding characters.\r\n\r\n Example:\r\n\r\ntext2='''\r\nU+25A0\tBlack square\r\nU+25A1\tWhite square\r\nU+25A2\tWhite square with rounded corners\r\nU+25A3\tWhite square containing small black square\r\nU+25A4\tSquare with horizontal fill\r\nU+25A5\tSquare with vertical fill\r\nU+25A6\tSquare with orthogonal crosshatch fill\r\nU+25A7\tSquare with upper left to lower right fill\r\nU+25A8\tSquare with upper right to lower left fill\r\nU+25A9\tSquare with diagonal crosshatch fill\r\nU+25AA\tBlack small square\r\nU+25AB\tWhite small square\r\nU+25AC\tBlack rectangle\r\nU+25AD\tWhite rectangle\r\nU+25AE\tBlack vertical rectangle\r\nU+25AF\tWhite vertical rectangle\r\nU+25B0\tBlack parallelogram\r\nU+25B1\tWhite parallelogram\r\nU+25B2\tBlack up-pointing triangle\r\nU+25B3\tWhite up-pointing triangle\r\nU+25B4\tBlack up-pointing small triangle\r\nU+25B5\tWhite up-pointing small triangle\r\nU+25B6\tBlack right-pointing triangle\r\nU+25B7\tWhite right-pointing triangle\r\nU+25B8\tBlack right-pointing small triangle\r\nU+25B9\tWhite right-pointing small triangle\r\nU+25BA\tBlack right-pointing pointer\r\nU+25BB\tWhite right-pointing pointer\r\nU+25BC\tBlack down-pointing triangle\r\nU+25BD\tWhite down-pointing triangle\r\nU+25BE\tBlack down-pointing small triangle\r\nU+25BF\tWhite down-pointing small triangle\r\nU+25C0\tBlack left-pointing triangle\r\nU+25C1\tWhite left-pointing triangle\r\nU+25C2\tBlack left-pointing small triangle\r\nU+25C3\tWhite left-pointing small triangle\r\nU+25C4\tBlack left-pointing pointer\r\nU+25C5\tWhite left-pointing pointer\r\nU+25C6\tBlack diamond\r\nU+25C7\tWhite diamond\r\nU+25C8\tWhite diamond containing small black diamond\r\nU+25C9\tFisheye\r\nU+25CA\tLozenge\r\nU+25CB\tWhite circle\r\nU+25CC\tDotted circle\r\nU+25CD\tCircle with vertical fill\r\nU+25CE\tBullseye\r\nU+25CF\tBlack circle\r\nU+25D0\tCircle with left half black\r\nU+25D1\tCircle with right half black\r\nU+25D2\tCircle with lower half black\r\nU+25D3\tCircle with upper half black\r\nU+25D4\tCircle with upper right quadrant black\r\nU+25D5\tCircle with all but upper left quadrant black\r\nU+25D6\tLeft half circle black\r\nU+25D7\tRight half black circle\r\nU+25D8\tInverse bullet\r\nU+25D9\tInverse white circle\r\nU+25DA\tUpper half inverse white circle\r\nU+25DB\tLower half inverse white circle\r\nU+25DC\tUpper left quadrant circular arc\r\nU+25DD\tUpper right quadrant circular arc\r\nU+25DE\tLower right quadrant circular arc\r\nU+25DF\tLower left quadrant circular arc\r\nU+25E0\tUpper half circle\r\nU+25E1\tLower half circle\r\nU+25E2\tBlack lower right triangle\r\nU+25E3\tBlack lower left triangle\r\nU+25E4\tBlack upper left triangle\r\nU+25E5\tBlack upper right triangle\r\nU+25E6\tWhite bullet\r\nU+25E7\tSquare with left half black\r\nU+25E8\tSquare with right half black\r\nU+25E9\tSquare with upper left diagonal half black\r\nU+25EA\tSquare with lower right diagonal half black\r\nU+25EB\tWhite square with vertical bisecting line\r\nU+25EC\tWhite up-pointing triangle with dot\r\nU+25ED\tUp-pointing triangle with left half black\r\nU+25EE\tUp-pointing triangle with right half black\r\nU+25EF\tLarge circle\r\nU+25F0\tWhite square with upper left quadrant\r\nU+25F1\tWhite square with lower left quadrant\r\nU+25F2\tWhite square with lower right quadrant\r\nU+25F3\tWhite square with upper right quadrant\r\nU+25F4\tWhite circle with upper left quadrant\r\nU+25F5\tWhite circle with lower left quadrant\r\nU+25F6\tWhite circle with lower right quadrant\r\nU+25F7\tWhite circle with upper right quadrant\r\nU+25F8\tUpper left triangle\r\nU+25F9\tUpper right triangle\r\nU+25FA\tLower-left triangle\r\nU+25FB\tWhite medium square\r\nU+25FC\tBlack medium square\r\nU+25FD\tWhite medium small square\r\nU+25FE\tBlack medium small square\r\nU+25FF\tLower right U+25FF triangle\r\n'''\r\n\r\nte=convert_2_unicode(text2)\r\nprint(te)\r\n\r\noutput:\r\n\r\n\u25a0\tBlack square\r\n\u25a1\tWhite square\r\n\u25a2\tWhite square with rounded corners\r\n\u25a3\tWhite square containing small black square\r\n\u25a4\tSquare with horizontal fill\r\n\u25a5\tSquare with vertical fill\r\n\u25a6\tSquare with orthogonal crosshatch fill\r\n\u25a7\tSquare with upper left to lower right fill\r\n\u25a8\tSquare with upper right to lower left fill\r\n\u25a9\tSquare with diagonal crosshatch fill\r\n\u25aa\tBlack small square\r\n\u25ab\tWhite small square\r\n\u25ac\tBlack rectangle\r\n\u25ad\tWhite rectangle\r\n\u25ae\tBlack vertical rectangle\r\n\u25af\tWhite vertical rectangle\r\n\u25b0\tBlack parallelogram\r\n\u25b1\tWhite parallelogram\r\n\u25b2\tBlack up-pointing triangle\r\n\u25b3\tWhite up-pointing triangle\r\n\u25b4\tBlack up-pointing small triangle\r\n\u25b5\tWhite up-pointing small triangle\r\n\u25b6\tBlack right-pointing triangle\r\n\u25b7\tWhite right-pointing triangle\r\n\u25b8\tBlack right-pointing small triangle\r\n\u25b9\tWhite right-pointing small triangle\r\n\u25ba\tBlack right-pointing pointer\r\n\u25bb\tWhite right-pointing pointer\r\n\u25bc\tBlack down-pointing triangle\r\n\u25bd\tWhite down-pointing triangle\r\n\u25be\tBlack down-pointing small triangle\r\n\u25bf\tWhite down-pointing small triangle\r\n\u25c0\tBlack left-pointing triangle\r\n\u25c1\tWhite left-pointing triangle\r\n\u25c2\tBlack left-pointing small triangle\r\n\u25c3\tWhite left-pointing small triangle\r\n\u25c4\tBlack left-pointing pointer\r\n\u25c5\tWhite left-pointing pointer\r\n\u25c6\tBlack diamond\r\n\u25c7\tWhite diamond\r\n\u25c8\tWhite diamond containing small black diamond\r\n\u25c9\tFisheye\r\n\u25ca\tLozenge\r\n\u25cb\tWhite circle\r\n\u25cc\tDotted circle\r\n\u25cd\tCircle with vertical fill\r\n\u25ce\tBullseye\r\n\u25cf\tBlack circle\r\n\u25d0\tCircle with left half black\r\n\u25d1\tCircle with right half black\r\n\u25d2\tCircle with lower half black\r\n\u25d3\tCircle with upper half black\r\n\u25d4\tCircle with upper right quadrant black\r\n\u25d5\tCircle with all but upper left quadrant black\r\n\u25d6\tLeft half circle black\r\n\u25d7\tRight half black circle\r\n\u25d8\tInverse bullet\r\n\u25d9\tInverse white circle\r\n\u25da\tUpper half inverse white circle\r\n\u25db\tLower half inverse white circle\r\n\u25dc\tUpper left quadrant circular arc\r\n\u25dd\tUpper right quadrant circular arc\r\n\u25de\tLower right quadrant circular arc\r\n\u25df\tLower left quadrant circular arc\r\n\u25e0\tUpper half circle\r\n\u25e1\tLower half circle\r\n\u25e2\tBlack lower right triangle\r\n\u25e3\tBlack lower left triangle\r\n\u25e4\tBlack upper left triangle\r\n\u25e5\tBlack upper right triangle\r\n\u25e6\tWhite bullet\r\n\u25e7\tSquare with left half black\r\n\u25e8\tSquare with right half black\r\n\u25e9\tSquare with upper left diagonal half black\r\n\u25ea\tSquare with lower right diagonal half black\r\n\u25eb\tWhite square with vertical bisecting line\r\n\u25ec\tWhite up-pointing triangle with dot\r\n\u25ed\tUp-pointing triangle with left half black\r\n\u25ee\tUp-pointing triangle with right half black\r\n\u25ef\tLarge circle\r\n\u25f0\tWhite square with upper left quadrant\r\n\u25f1\tWhite square with lower left quadrant\r\n\u25f2\tWhite square with lower right quadrant\r\n\u25f3\tWhite square with upper right quadrant\r\n\u25f4\tWhite circle with upper left quadrant\r\n\u25f5\tWhite circle with lower left quadrant\r\n\u25f6\tWhite circle with lower right quadrant\r\n\u25f7\tWhite circle with upper right quadrant\r\n\u25f8\tUpper left triangle\r\n\u25f9\tUpper right triangle\r\n\u25fa\tLower-left triangle\r\n\u25fb\tWhite medium square\r\n\u25fc\tBlack medium square\r\n\u25fd\tWhite medium small square\r\n\u25fe\tBlack medium small square\r\n\u25ff\tLower right \u25ff triangle\r\n\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Converts Hexadecimal Unicode Codes with the prefix 'U+/u+' in text to Corresponding Characters",
"version": "0.11",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/unicodekonverter"
},
"split_keywords": [
"convert",
"unicode",
"utf-8"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1b445f5dd494c1ffa0bcc7ec06093d7d1cd795a3f1ec173e9e6b3ddc9422a997",
"md5": "17927609eb33cc2efe848b3494d522f3",
"sha256": "0905b01f628a5e49d15c1c1d5f51a35a539b5772be48658149b217e5c1ae6cdc"
},
"downloads": -1,
"filename": "unicodekonverter-0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "17927609eb33cc2efe848b3494d522f3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 13830,
"upload_time": "2023-08-21T13:24:00",
"upload_time_iso_8601": "2023-08-21T13:24:00.088998Z",
"url": "https://files.pythonhosted.org/packages/1b/44/5f5dd494c1ffa0bcc7ec06093d7d1cd795a3f1ec173e9e6b3ddc9422a997/unicodekonverter-0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c0ff55b4c6c523fdc71ee6f9114e892510515dd976be286c43e46c9f9489db88",
"md5": "11f138fe9701e68494dd2481ebd46988",
"sha256": "81ac30b2e279a6993711d8dc20e5199d96afd519c8591999ec883370a169e916"
},
"downloads": -1,
"filename": "unicodekonverter-0.11.tar.gz",
"has_sig": false,
"md5_digest": "11f138fe9701e68494dd2481ebd46988",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12138,
"upload_time": "2023-08-21T13:24:01",
"upload_time_iso_8601": "2023-08-21T13:24:01.439835Z",
"url": "https://files.pythonhosted.org/packages/c0/ff/55b4c6c523fdc71ee6f9114e892510515dd976be286c43e46c9f9489db88/unicodekonverter-0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-21 13:24:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "unicodekonverter",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "unicodekonverter"
}