user8283671
user8283671

Reputation:

Node js Convert from utf-8

I have a product names in mysql but the some names are with Ö Ə Ü etc. I have to convert this chars to O E U and write to the jpeg file name. I try to use utf8 package but it convert to üzlük for example. How can I do this?

Upvotes: 4

Views: 168

Answers (2)

Rob
Rob

Reputation: 11788

Please note that this would be a one-way operation, a Ö is not the same as an O. Instead of using the product names themselves, I would rather create a MD5 hash from them and use the hashes as filenames.

Upvotes: 2

Anatol - user3173842
Anatol - user3173842

Reputation: 1415

I don't think there is another option than replacing all those characters using a table containing all characters together with their replacement.

Luckily there is already a library solving this problem: https://github.com/dundalek/latinize

Upvotes: -1

Related Questions