This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compound_unicode(unicode_str): | |
""" | |
Chuyển đổi chuỗi Unicode Tổ Hợp sang Unicode Dựng Sẵn | |
Edited from: `https://gist.github.com/redphx/9320735` | |
""" | |
unicode_str = unicode_str.replace("\u0065\u0309", "\u1EBB") # ẻ | |
unicode_str = unicode_str.replace("\u0065\u0301", "\u00E9") # é | |
unicode_str = unicode_str.replace("\u0065\u0300", "\u00E8") # è | |
unicode_str = unicode_str.replace("\u0065\u0323", "\u1EB9") # ẹ | |
unicode_str = unicode_str.replace("\u0065\u0303", "\u1EBD") # ẽ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function CompositeUnicodeToUnicode($unicode_str){ | |
$unicode_str = str_replace("\u{0065}\u{0309}", "\u{1EBB}",$unicode_str); # ẻ | |
$unicode_str = str_replace("\u{0065}\u{0301}", "\u{00E9}",$unicode_str); # é | |
$unicode_str = str_replace("\u{0065}\u{0300}", "\u{00E8}",$unicode_str); # è | |
$unicode_str = str_replace("\u{0065}\u{0323}", "\u{1EB9}",$unicode_str); # ẹ | |
$unicode_str = str_replace("\u{0065}\u{0303}", "\u{1EBD}",$unicode_str); # ẽ | |
$unicode_str = str_replace("\u{00EA}\u{0309}", "\u{1EC3}",$unicode_str); # ể | |
$unicode_str = str_replace("\u{00EA}\u{0301}", "\u{1EBF}",$unicode_str); # ế | |
$unicode_str = str_replace("\u{00EA}\u{0300}", "\u{1EC1}",$unicode_str); # ề |