Question

I'm working on a Joomla site with Fabrik and problem is that Fabrik serializes some data using json_encode() but does not take into account the possibility of åäö and such. Now when a database search is made, it tries to find stuff with åäö, but doesn't find anything, because

everything is \u00e4 and \u00f6

and so forth.

I'm not much for digging into Fabrik's code and inserting one flag somewhere and worry about accidentally overwriting it when I update Fabrik. So I figured, since I'm disappointed in Fabrik anyway, I could just write around it completely in a custom template. Easy.

The problem is that I can't find a way or a function like htmlentities() that I can just feed the stuff to to make it match. I could just character replace them, but that's not a good solution.

Paraphrase: I wanna make word Mörkö into -> M\u00f6rk\u00f6. How?

Was it helpful?

Solution

Maybe there's another way but that works as excepted :

$encoded = substr(json_encode('Mörkö'), 1, -1);

json_encode('Mörkö') => "M\u00f6rk\u00f6"

substr() => M\u00f6rk\u00f6

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top