creecros / MetaMagik

Custom Fields for Kanboard - Plugin MetaMagik
MIT License
99 stars 16 forks source link

The name of Custom Field does not support Chinese characters #61

Open apsonandtesla opened 4 years ago

apsonandtesla commented 4 years ago

Hi I just found out that when creating custom fields, the name of that field seems not supporting Chinese characters, as when I set the name in Chinese, it will not show up neither in management page nor in card.

I am not sure if this only happens to Chinese or it happens to all non-latin characters.

neotaburiss commented 3 years ago

Hello, new to Github, but my team have been using Kanboard & MetaMagik for nearly 3 month and found it very useful. Since now custom fields do not support Chinese and non-latin characters, we can only input English, that cuase some misunderstanding/errors on different field. so we would ask if any chance to repair that? just thinking this bug may be related to UTF-8 encoding.

creecros commented 3 years ago

it's the preg_replace's. if you remove them, there are no restrictions. they were in the original unused code from metadata manager plugin, and I have no idea why. it's really just a matter of me remembering to fix it next time I get a chance, I actually did once, but forgot to send the commit.

it happens here in this method: https://github.com/creecros/MetaMagik/blob/ce77e957844a19f9eae925c2e5f593c99c3104f2/Controller/MetadataTypesController.php#L128

should probably be something like this instead: preg_replace("![^\p{L}\p{N}\s]!", "", $search);

neotaburiss commented 3 years ago

it's the preg_replace's. if you remove them, there are no restrictions. they were in the original unused code from metadata manager plugin, and I have no idea why. it's really just a matter of me remembering to fix it next time I get a chance, I actually did once, but forgot to send the commit.

it happens here in this method: https://github.com/creecros/MetaMagik/blob/ce77e957844a19f9eae925c2e5f593c99c3104f2/Controller/MetadataTypesController.php#L128

should probably be something like this instead: preg_replace("![^\p{L}\p{N}\s]!", "", $search);

Many thanks for your update, it now works great.

creecros commented 3 years ago

That didn't work for me at all, I had to remove the lines completely.

creecros commented 3 years ago

If someone smarter than me can figure out the correct preg_replace, i will be happy to update the code in a PR. until then, just remove the lines if you need to get around this. I'll leave the issue open.