MetaMagik icon indicating copy to clipboard operation
MetaMagik copied to clipboard

The name of Custom Field does not support Chinese characters

Open apsonandtesla opened this issue 4 years ago • 5 comments

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.

apsonandtesla avatar Nov 03 '20 07:11 apsonandtesla

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.

neotaburiss avatar Feb 06 '21 01:02 neotaburiss

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);

creecros avatar Feb 06 '21 12:02 creecros

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.

neotaburiss avatar Feb 08 '21 08:02 neotaburiss

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

creecros avatar Feb 09 '21 15:02 creecros

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.

creecros avatar Feb 09 '21 15:02 creecros