Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upSanitize non-ASCII characters out of memorial file names. #3600
Conversation
This comment has been minimized.
This comment has been minimized.
|
internationalized character names with this are just a long line of underscores (especially long as each unicode character turns into 2-4 bytes in utf-8). i think i'd actually prefer removing the name and just using the timestamp. without it, utf-8 memorial filenames do work fine for me, but i guess that's because my filesystem uses utf-8 encoding for filenames. |
This comment has been minimized.
This comment has been minimized.
|
Perhaps just removing the offending characters - that way, if there's a single odd one in the middle of an otherwise-okay name, most of the name will still be there. |
This comment has been minimized.
This comment has been minimized.
|
well i mean for a chinese name they'll all be non-ascii. Even for russian characters that look the same, they use a different section of unicode, and so would all be non-ascii. I guess it could check how many characters were replaced, and if it's almost all or all, not use the name? |
ianestrachan
added some commits
Nov 17, 2013
This comment has been minimized.
This comment has been minimized.
|
Should be better now - if a name is entirely made of non-ASCII characters, it just has the timestamp, without the - in front. |
This comment has been minimized.
This comment has been minimized.
|
hmm, now it's removing everything except the spaces in between the names ><. Would a threshold work, like if the sanitized name is less than 1/5 of the original name it just uses the timestamp? |
This comment has been minimized.
This comment has been minimized.
|
Added the threshold, <= 20% of original length removes the name entirely. |
yobbobanana
merged commit f55bee3
into
CleverRaven:master
Nov 19, 2013
1 check failed
This comment has been minimized.
This comment has been minimized.
|
thanks :) |
ianestrachan commentedOct 12, 2013
Fixes #2845. I think.
I don't actually have a way to test this as I have no idea how to type Chinese characters into Cataclysm. It's a simple enough patch, and it SHOULD work, but I'd appreciate one of the international users confirming that it does what it's supposed to, at which point I'll take the [WIP] tag off.