[resolved] foxyshop_currency double-encodes utf8 (2 posts)

  1. pharazon
    Posted 3 years ago #

    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.


  2. sparkweb
    Plugin Author

    Posted 3 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic