update
This commit is contained in:
@@ -146,6 +146,26 @@ def api_get_hatching_permit_code(request):
|
||||
return Response({'detail': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
||||
|
||||
|
||||
def normalize_persian_arabic_text(text):
|
||||
"""
|
||||
نرمالسازی متن فارسی/عربی برای یکسانسازی کاراکترهای مشابه
|
||||
تبدیل کاراکترهای فارسی به عربی برای سازگاری با دیتابیس
|
||||
این تابع کاراکترهای 'ک' و 'ی' فارسی را به 'ك' و 'ي' عربی تبدیل میکند
|
||||
تا با فرم استاندارد ذخیره شده در دیتابیس مطابقت داشته باشد
|
||||
"""
|
||||
if not text:
|
||||
return text
|
||||
|
||||
# تبدیل کاراکترهای فارسی به عربی
|
||||
# 'ک' (U+06A9 - Persian Kaf) -> 'ك' (U+0643 - Arabic Kaf)
|
||||
# 'ی' (U+06CC - Persian Yeh) -> 'ي' (U+064A - Arabic Yeh)
|
||||
text = str(text)
|
||||
text = text.replace('ک', 'ك') # Persian Kaf to Arabic Kaf
|
||||
text = text.replace('ی', 'ي') # Persian Yeh to Arabic Yeh
|
||||
|
||||
return text
|
||||
|
||||
|
||||
def create_guild(**info):
|
||||
|
||||
Guilds(
|
||||
|
||||
Reference in New Issue
Block a user