Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persian encoding #9

Open
bshafiei-ir opened this issue Oct 27, 2018 · 8 comments · Fixed by #82
Open

Persian encoding #9

bshafiei-ir opened this issue Oct 27, 2018 · 8 comments · Fixed by #82

Comments

@bshafiei-ir
Copy link

It doesn't work for Unicode characters such as "نوشتار فارسی".
How should I do?

@ctolkien
Copy link
Owner

Hi,

Hrm, so this is really supposed to be language agnostic, it will strip diacratic to their base a-z character. I don't really have any idea on how to handle non-latin languages.

Can you advise what a slugged output should be for those characters?

@bshafiei-ir
Copy link
Author

Yes. For example

input;
جای مردان سیاست بنشانید درخت تا هوا تازه شود.

output:
جای_مردان_سیاست_بنشانید_درخت_تا_هوا_تازه_شود.

I have seen one git project but the main problem is that, it wrote on .net framework 4.6 and has some conflict on .net core 2

@ctolkien
Copy link
Owner

This lib has a "known" character set based on the latin alphabet... Not really sure how we could handle this one.

@arisliang
Copy link

arisliang commented Apr 3, 2023

handle in the same way? not the most dynamic way, but it seem to works. another project for ref

@ctolkien
Copy link
Owner

ctolkien commented May 9, 2023

Resurfacing this..... the linked project from @arisliang has a mapping from unicode characters from other languages to an ascii set.

With the source text of: نوشتار فارسی, that would result in nwshtr-frsy

Does that actually solve the issue that people have here?

@nnhhttmmjjyy
Copy link

As an example, there is another library used on the frontend https://github.com/pid/speakingurl, which also uses character mapping and can be taken as a reference. Character mapping can be found in this file

Input:
Наизусть

Output:
naizust

A character mapping can be created by comparing the characters in the other libraries to include all common characters.

@ctolkien
Copy link
Owner

ctolkien commented Jul 22, 2023

Please see #82 for feedback.

@ctolkien
Copy link
Owner

This is currently in a prerelease v5, you can trial it via:

dotnet add package Slugify.Core --version 5.0.0-prerelease.4

cc @bshafiei-ir , @nnhhttmmjjyy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants