View Single Post
Old 02-24-2023, 05:56 AM   #6
lomkiri
Groupie
lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.
 
lomkiri's Avatar
 
Posts: 167
Karma: 1497966
Join Date: Jul 2021
Device: N/A
Quote:
Originally Posted by hihohahi View Post
I have similar issue but with Arabic numbers. They randomly show up in my epub. I don't know any way to solve it so I made a simple macro AHK script and just run it every file.
You can do it with a "replace all" and a simple regex-functon:

Code:
search: 
[\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669]

Replace: 
def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    str_in  = '\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669'
    str_out = '0123456789'
    table = str.maketrans(str_in, str_out)
    return match[0].translate(table)
lomkiri is offline   Reply With Quote