Recent Topics

[3.1-beta] non-logged-in Locale Bug

Started by on Apr 09, 2009 – Contents updated: Apr 09, 2009

Apr 09, 2009 16:59    

I just noticed this tonight because I cleaned up my browser's cookies/passwords/sessions/cache.

So, when I am logged-in to b2evolution, non-Latin characters shows up correctly in the 'Public Blog List' widget at the 'Page Top' container, in this case: 心道

But when I am a guest of the site, non-Latin characters shows up as, in my example above: ??

The DB is all set to utf8: utf8_unicode_ci
MySQL charset is: utf8
MySQL connection collation is: utf_8_unicode_ci

the conf/_locales.php is also set

PHP

$force_io_charset_if_accepted 'utf-8';
$db_config['connection_charset'] = 'utf8';

Blog: http://laibcoms.asia/blog/

Is there something with "logged-off" that is causing the non-rendering as compared to the "logged-in" ?? Or maybe the toolbar? Or something else?

Anyway, haven't done any other testing. This was just an immediate report before I forget to report it.

Hmm, iirc, it was fine pre-3.1-beta release.

Apr 09, 2009 18:04

Ok, just an update, after a few tests and experiments, I found what I think the culprit is.

the "anonymous" locale setting

Here's what I have:
1) Global Settings -> Regional
2) I cloned/copied en-US / English (US)
3) Created a new locale en-PH / English (PH); the changes are:

  • Locale: en-PH
  • Name: English (PH)
  • Charset: utf-8
  • Priority: 1
  • [/list:u]

    I kept the "Lang file: en_US" field as-is since I don't want to create a lang file for en-PH in the locales directory.

    4) Set the "Default locale" to English (PH)
    5) Clicked the Save button
    6) Set the locale of each blog to English (PH) as well
    7) Set my user locale to English (PH) too

    Since I'm entering non-Latin characters, and my user localed is set to English (PH) which is a utf-8 b2evolution "regional" locale, when I log-in the non-Latin characters show up correctly.

    If I log-out, then that's when the problem as stated in the previous post shows up.

    It appears now that the "anonymous" locale is not set to my:
    b2evolution Default Locale which is English (PH); and
    Blog Main Locale which is also English (PH)

    BUT, when we view the Page Source, it is correctly in UTF-8!

    I then tried to change the English (US) and English (GB) to utf-8 as well via the Regional settings.

    I logged-out and voila, it works fine now for "anonymous".

    So the possible bugs as per this experiment are:
    a) Regional Locale is getting mixed-up somewhere

    • Since the Page Source shows a charset of UTF-8; we can assume that the English (PH) setting was parsed correctly
    • But for some reason, the rest of the page is then rendered in English (US)
    • [/list:u]
      b) The Regional Locale and/or Blog Locale are not getting recognized for "anonymous"
      c) It is also possible that, since my English (PH) "Lang file" is set to "en_US" locales file (in the locale directory), it loads the default enconding of en_US/en-US/English (US).

      • After I explicitly changed English (US) via the Regional settings tab to utf-8, the problem for "anonymous" was fixed
      • [/list:u]
        d) The locale of "anonymous" is fixed to the Regional settings locale "English (US)" (related to letter 'a' above)

        If I change the locale English (US) [via the Regional settings tab] to iso-8859-1 then logout, the problem explained above is back.

Apr 10, 2009 03:59

OMG 8| too many words for me. Try to edit the existing en-US to utf-8 in regional settings, this is all you have to do.

Why create another locale if you can change the charset in one place...

Apr 10, 2009 04:16

um... wouldn't it make more sense to find out why an installation that is supposed to be English (PH) is showing as English (US) instead of just cobbling a patch?

Apr 10, 2009 06:20

sam2kb wrote:

OMG 8| too many words for me. Try to edit the existing en-US to utf-8 in regional settings, this is all you have to do.

Why create another locale if you can change the charset in one place...

For various reasons ^_^ Mainly for testing purposes. It just happened that I started with "en-PH", I could and can use "jp" or "fil" or "fil-Tglg" or "cn".

Secondly, well, en-US is en-US, not any other language ;) The encoding is just the second part of a locale, the main part is the language.

EdB wrote:

um... wouldn't it make more sense to find out why an installation that is supposed to be English (PH) is showing as English (US) instead of just cobbling a patch?

That's my report above :p The "anonymous" ie non-logged-in or site-guest/visitor is going back to Regional locale "English (US)". It's somewhere there, and I think that's beyond me.

^_^

Apr 10, 2009 12:30

Laibcoms wrote:

... The "anonymous" ie non-logged-in or site-guest/visitor is going back to Regional locale "English (US)". It's somewhere there, and I think that's beyond me.

^_^

At least you understand enough to dig in for analysis! I look at it and think "good thing this app shows up in a language I know..." ;) I poked into the files for 3.1.0.bc and couldn't even find where all the locales are listed anymore so there ain't no way I'd be able to figure out why it decides an installation that was "ab_CD" suddenly becomes "ef_GH" when the boss ain't looking.

Dec 11, 2010 14:18

yea.. too many words for me too...couldn't read the whole thing. but this "problem" persists in 3.3.3...

everything was fine until after i enabled new locales "en-us" & "ru-Ru" for sam2kb to use.

Then i viewed my blog as a visitor and non-latins were converted to ????'s.

Anyway, i overcame the situation by forcing the charset as above.. just wanted to add when it happened to identify the problem and whether this is a bug or not

Dec 11, 2010 20:19

Disable en-US and enable en-US-utf8


Form is loading...

powered by b2evolution free blog software – This forum is powered by b2evolution CMS, a complete engine for your website.