Skip to main content
Topic: What is $context['utf8'] in EA? (Read 2063 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

What is $context['utf8'] in EA?

What is $context['utf8'] equivalent code in EA, if any? It is reported as an undefined error.

Re: What is $context['utf8'] in EA?

Reply #1

If I got it right, $context['convert_utf8'] in SMF is true if the forum is configured to use UTF-8, false otherwise.
ElkArte is UTF8-only, so I guess we just dropped the variable because pointless (in the sense that it shall be always true).
Bugs creator.
Features destroyer.
Template killer.

Re: What is $context['utf8'] in EA?

Reply #2

I know EA is UTF-8 only as I was asking about this charset last time, but for social login addon (that I am converting) it will get data from the social media API which may not be in UTF-8 form, thus that need to be converted to UTF-8. Thus, there is a need for that, at least to be added to the addon.

Can you point me where or how do I create this UTF-8 check as I am not so sure how to do it?

Re: What is $context['utf8'] in EA?

Reply #3

All the relevant code I can find regarding to UTF-8 is:
Code: [Select]
		// Encode.
if (!$context['utf-8'])
{
$regOptions ['extra_register_vars'] ['location'] = utf8_decode($regOptions ['extra_register_vars'] ['location']);
$regOptions ['extra_register_vars'] ['real_name'] = utf8_decode($regOptions ['extra_register_vars'] ['real_name']);
$regOptions ['extra_register_vars'] ['personal_text'] = utf8_decode($regOptions ['extra_register_vars'] ['personal_text']);
$regOptions ['username'] = utf8_decode($regOptions ['username']);
}
now, this reads "if the forum is not using UTF-8, then let's take the response from the server and convert it from UTF-8 to ISO-8859-1[1].
Elk is UTF-8, so $context['utf-8'] would always be true, and that block of code would never be executed.
So it's pointless to have, just remove it altogether. ;)

Is there anything else I missed?
That BTW would be broken for any language that do need something different from ISO-8859-1...
Bugs creator.
Features destroyer.
Template killer.

Re: What is $context['utf8'] in EA?

Reply #4

I do believe that's data that I am talking about and it is taken from the social media sites for the forum. That particular option is available in the OneAll control panel/settings. There is no point on taking it from the forum for media sites. But I may be wrong.

Anyway, that is not a main issue for me to make it work but the ip address. For this utf-8 undefined error, I think I could  uncomment it temporarily.

Re: What is $context['utf8'] in EA?

Reply #5

Quote from: ahrasis – I do believe that's data that I am talking about and it is taken from the social media sites for the forum. That particular option is available in the OneAll control panel/settings. There is no point on taking it from the forum for media sites. But I may be wrong.
I think you lost me here, but I'll try with a wild guess.
The bit of code comes from the addon.
The $context['utf-8'] comes from SMF.
The data in $regOptions come from... I guess from OneAll server (at least in part, not sure because I never used it).
But anyway, the important bit that is the utf-8 is from SMF.

Quote from: ahrasis – Anyway, that is not a main issue for me to make it work but the ip address.
Posted there. :)

Quote from: ahrasis – For this utf-8 undefined error, I think I could  uncomment it temporarily.
I'm not sure about uncommenting, comment the entire block out, yes. Comment out only the "if" line I would say it's not a good idea. But again I never used or tried so I can't be entirely sure.
Bugs creator.
Features destroyer.
Template killer.