Can't create poll with some Chinese options

[poll name=poll2 type=regular results=always chartType=bar]
* Microsoft Edge(新)
* Microsoft Edge(旧)

When I was trying to create the poll as above, I met with “Poll must have different options”.

After debugging, I figure out that there’s some wrong with the md5 function:

md5("Microsoft Edge(新)") = 695bf1ac483d572e5311e3bc9574616a
md5("Microsoft Edge(旧)") = 695bf1ac483d572e5311e3bc9574616a

This seems weird…

I looked through the code and found that /[\x80-\xFF]/.test(s) in L407 can’t correctly detect these Chinese strings.

I fixed this by forcing a conversion to UTF-8 “bytes” and made a PR to your official repo.

BTW, the following poll can’t be created, neither.

[poll name=poll1 type=regular results=always chartType=bar]
* 华东其他地区
* 华南其他地区
* 华北其他地区

Thank You!

Change looks safe, but we need to confirm that there are no backwards compatibility concerns here. @zogstrip can you have a quick look at the PR?


This was merged so I’m going to close the issue.

1 Like