Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preg_replace_callback handling of danish characters #32

Open
webformdk opened this issue Oct 15, 2014 · 4 comments
Open

preg_replace_callback handling of danish characters #32

webformdk opened this issue Oct 15, 2014 · 4 comments

Comments

@webformdk
Copy link

After latest version of FX.php where 'preg_replace' was changed to ‘preg_replace_callback’ in RetrieveFMXML.class.php, FX.php no longer display danish characters like æøå correctly - They output more like japanese characters!

@aragon66
Copy link

Persistent problem, this. Has a solution been identified?

An example:
"é" {Char(223)} is in my database field is transformed to "ラ"
{char(12521)} by FX for browser display**.
When I revert RetrieveFMXML.class.php file to the older version (using
deprecated 'preg_replace'.), it properly displays "é" in browser.

** using latest download of FX.php from github on running with
PHP5.5/Apache2.4, FMS 14.

How can I get it to correctly handle special unicode characters?

@APD183
Copy link
Contributor

APD183 commented Aug 12, 2016

I am not where I can test this right now, but if you replace this function on line 51 of RetrieveFMXML.class.php does it work?

function utf8HTMLEntities($matches) {
    // $matches contains full match as first item so everything is +1
    if(count($matches) == 3){
        return $this->FX->BuildExtendedChar($matches[1],$matches[2]);
    }elseif(count($matches) == 4){
        return $this->FX->BuildExtendedChar($matches[1],$matches[2],$matches[3]);
    }elseif(count($matches) == 5){
        return $this->FX->BuildExtendedChar($matches[1],$matches[2],$matches[3],$matches[4]);
    }
return ''; // TODO something went wrong, but this should be explicit someday
}

@aragon66
Copy link

aragon66 commented Aug 12, 2016

Yes, that revised function appears to deliver the correct characters!

Does this fix or break things for anyone else?

On Fri, Aug 12, 2016 at 7:05 PM, Andrew Denman [email protected]
wrote:

function utf8HTMLEntities($matches) {
// $matches contains full match as first item so everything is +1
if(count($matches) == 3){
return $this->FX->BuildExtendedChar($matches[1],$matches[2]);
}elseif(count($matches) == 4){
return $this->FX->BuildExtendedChar($matches[1],$matches[2],$matches[3]);
}elseif(count($matches) == 5){
return $this->FX->BuildExtendedChar($matches[1],$matches[2],$matches[3],$matches[4]);
}
}

@yodarunamok
Copy link
Owner

It appears to me that this fix is present in the current version of FX.php (version 6.10 as of this writing.) I'm trying to address a bunch of things right now, so please let me know if this is not fixed at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants