Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Emil Gustafsson

    (@gesen)

    Hi,

    The plugin has not been tested with Arabic filenames. The plugin uses the WordPress core function sanitize_title() to translate the filenames into clean filenames. I will try to dig a little deeper and maybe complement this function with some more code that better handles Arabic and other unicode characters.

    Thread Starter Jer Clarke

    (@jeremyclarke)

    In case it helps, here is the function I ultimately created that solves my particular problem (that my RSS feed is invalidated if I have a “URL” property that includes Unicode symbols in the filename):

    function gv_rawurlencode_url_filename($url) {
    	/**
    	 * Extract only the filename from the URL (encoding other parts messes up URL structure)
    	 */
    	$url_parts = parse_url($url);
    	$url_pathinfo = pathinfo($url_parts['path']);
    	$url_filename = $url_pathinfo['filename'];
    
    	/**
    	 * Encode the filename to avoid Unicode errors
    	 */
    	$filtered_filename = rawurlencode($url_filename);
    
    	/**
    	 * If encoding changed the filename repace it in the $url
    	 */
    	if ($url_filename !== $filtered_filename) :
    		$url = str_replace($url_filename, $filtered_filename, $url);
    	endif;
    
    	return $url;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Breaks Arabic (and presumably other unicode) filenames’ is closed to new replies.