Skip to content

Joomla CMS [#27526] Media manager doesn't support multi-byte characters #997

wants to merge 1 commit into from

4 participants

oc666 commented Mar 18, 2012

This will add support for multi-byte file name on onsafe method of file class. The default is full backward compatible, and not using multi-byte file name.

Joomla! member

Wouldn't it make sense to always support multibypte characters? (without the argument)

Also I wonder if phputf8 doesn't have some function that could help you.

oc666 commented Mar 24, 2012

I left it without support by default for backward compatibility.
If you found phputf8 function that make this trick, please, let me know.

Joomla! member

I don't even know what your change does, I don't speak regex ;) That's why I haven't pulled it either.

@pasamio pasamio commented on the diff Aug 14, 2012
- $regex = array('#(\.){2,}#', '#[^A-Za-z0-9\.\_\- ]#', '#^\.#');
- return preg_replace($regex, '', $file);
+ if ($multibyte)
+ {
+ $search = "/\?%*:|\"<>#;()&;, ";
+ return str_replace(str_split($search), '_', $filename);
pasamio added a note Aug 14, 2012

Shouldn't we use something that is UTF-8 safe here? Perhaps a preg_replace with the u modifier to ensure we don't clobber parts of multibyte characters?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

@oc666 I'd love to see this get merged. Would you mind putting together a few test cases so that we can verify that everything works as expected? I do think that we may have an issue with multibyte characters, but trust that you can/will test that out for us. I'm going to close this until we get a couple of tests to ensure everything works and we don't have any regressions down the road. Please re-open this when you get that sorted out.

@LouisLandry LouisLandry closed this Oct 9, 2012
oc666 commented Nov 5, 2012

@LouisLandry, can you guide me to some simple guide or example for Joomla unit test?

Thanks, Ofer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.