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

Allow alternative placeholders for unknown characters #1

Closed
epage opened this issue Sep 7, 2018 · 2 comments
Closed

Allow alternative placeholders for unknown characters #1

epage opened this issue Sep 7, 2018 · 2 comments

Comments

@epage
Copy link

epage commented Sep 7, 2018

From the docs

/// * Some Unicode characters transliterate to an empty string, either on purpose
/// or because deunicode does not know about the character.
/// * Some Unicode characters are unknown and transliterate to "[?]".

  1. It isn't clear when an empty string vs [?] is used
  2. I might want to do something different here, either detect and report an error to the user, put in my own character, etc.

A limited workaround exists

let custom_replacement = "?";
"string".chars().map(|c|deunicode_char(c).unwrap_or(custom_replacement)).collect::<String>()

but deunicode does a lot more than that (spacing logic).

(fork of chowdhurya#4)

@epage
Copy link
Author

epage commented Sep 7, 2018

Originally I wanted to use my own character but I am using this for URLs and need to maintain compatibility, so I think erroring to the user and requiring them to give me a slug would be better.

@kornelski
Copy link
Owner

ok, done in 0a850a8

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

No branches or pull requests

2 participants