vinkla / hashids

A small PHP library to generate YouTube-like ids from numbers. Use it when you don't want to expose your database ids to the user.
https://hashids.org/php
MIT License
5.28k stars 418 forks source link

mb_convert_encoding(): Illegal character encoding specified #154

Closed shanezhiu closed 4 years ago

shanezhiu commented 4 years ago

ENV

code snippet

 $salt = random_bytes(mt_rand(6, 11));
 $inneralCoding = \mb_detect_encoding($salt);
 $hashIds = new Hashids($salt);

question

When$inneralCoding is false, a new instance Hashids will be failed.

is there neccessary to ensure the salt is UTF-8 encoding?

vinkla commented 4 years ago

Thanks for your suggestion @shanezhiu but we currently don't have any plans to not ensure UTF-8 encoding.