Support » Plugin: FoxyShop » foxyshop_currency double-encodes utf8

  • Resolved pharazon

    (@pharazon)


    Hello, we have an issue with foxyshop_currency() function. The money_format branch double-encodes the EURO symbol, when the locale is de_DE.UTF-8 (i.e. already UTF8).

    I think the fix for this would be to check if a UTF8 locale is already used, then do not utf8_encode it twice.

    http://wordpress.org/extend/plugins/foxyshop/

Viewing 1 replies (of 1 total)
  • Plugin Author sparkweb

    (@sparkweb)

    Great point! I noticed this last week but had been unsure of what to do about it. I think your solution is a good one. Here’s what I’ll be rolling into the next release of the plugin (current release is 4.1.6):

    function foxyshop_currency($input, $currencysymbol = true) {
    	global $foxyshop_settings;
    	if (function_exists('money_format')) {
    		$currency = money_format("%" . ($currencysymbol ? "" : "!") . ".2n", (double)$input);
    	} else {
    		//Windows: no internationalisation support
    		$currency_code = ($foxyshop_settings['locale_code'] == "en_GB" ? "£" : "$");
    		$currency = $currency_code.number_format((double)$input,2,".",",");
    	}
    	if (strpos($foxyshop_settings['locale_code'], "utf8") === false) $currency = utf8_encode($currency);
    	return apply_filters("foxyshop_currency", $currency);
    }

    Can you try replacing the function in helperfunctions.php and see if that works for you?

Viewing 1 replies (of 1 total)
  • The topic ‘foxyshop_currency double-encodes utf8’ is closed to new replies.