Recent Topics

Unicode charset (UTF-8) in b2evo

started by on 2007 Dec 30 – Last touched: 2007 Dec 30

2007 Dec 30 03:29    

You may also want to read this post: [url=http://forums.b2evolution.net/viewtopic.php?t=13366]HOW-TO: Configure b2evolution for non-English posts[/url]

Unicode charset (UTF-8) in b2evo

    1. Go to phpMyAdmin to create a database and set up its collation to utf8_unicode_ci.[/list:u]

      2. Find and edit this strings in /conf/_locales.php[/list:u]

      PHP

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

        3. Install b2evo in this database.[/list:u]
        This is it, but if you want to use another language by default, you need to make some more changes

          4. Download a [url=http://b2evolution.net/downloads/language-packs.html]language pack[/url], unzip and upload it to /locales directory.[/list:u]

            5. Now go to Backoffice -> Global Settings -> Regional and change Default locale. Then change Blog locale in Blog settings >YOUR BLOG > Global[/list:u]

            If you want to switch an existing b2evo database to use UTF-8 (when you upgrade it) do the following

              1. Buckup you database! And upgrade b2evo.[/list:u]

                2. Then you need to change collation from old to utf8_unicode_ci in each table. You have options to:

2008 Apr 16 19:44

It may be time to reconsider that part of b2evo by now.

Do you guys think we should make it all UTF-8 by default?

1) should the mysql tables be created as UTF-8 by default? (I believe most new users will have mysql servers that actually do support utf-8)

2) should we automatically upgrade all databases to UTF-8 in a future release? (might be tricky, I don't know)

3) should we convert all language packs to UTF-8 or at least have an UTF-8 version for each?

4) should we actually discard any language packs that are not UTF8 ?

5) should we make b2evo use UTF8 internally by default, although about 40% to 60% (not really sure yet) of the servers out there do not have the MB_STRING extension installed and therefore will not be able to handle NON ASCII text properly. That means if you blog in english you don't really care about not having MB_STRING, but if you blog with non ascii chars you may need to battle with your host or even switch to another host just to get mb_string.

What do you think?

2008 Apr 16 22:08

I think there should be a checkbox or something, when it checked user can install/upgrade using UTF-8 (1,2,5)

And of course when he install using UTF-8 there must be a UTF-8 version available of all 2.x language packs.

2008 Aug 20 19:27

Even after running script fixcharset.php mentioned in http://forums.b2evolution.net/viewtopic.php?t=13366, I had to manually reset some of the values in the database, specifically:

Code

evo_antispam
  aspm_string
 
evo_items__item
  post_content
  post_title
  post_urltitle
  post_url
  post_excerpt
  
evo_items__prerendering
  itpr_renderers
  itpr_content_prerendered
 
evo_comments
  comment_author
  comment_content

I've posted the details of how I got b2e to work with utf-8 for bilingual Russian-English posting [url=http://shininghappypeople.net/deljr/b2e-russian-english.html]here[/url].

2008 Sep 01 17:43

For fplanque questions, I think:

1 - Yes
2 - Yes
3 - A UTF-8 version of language packs
4 - No, for a while ;)
5 - This is complicated, but I vote yes too.

2009 Mar 11 07:54

fplanque wrote:

It may be time to reconsider that part of b2evo by now.

Do you guys think we should make it all UTF-8 by default?

A strong YES!

fplanque wrote:

1) should the mysql tables be created as UTF-8 by default? (I believe most new users will have mysql servers that actually do support utf-8)

A resounding YES!!

fplanque wrote:

2) should we automatically upgrade all databases to UTF-8 in a future release? (might be tricky, I don't know)

A whisper of "no". This might break existing installations. IMO, make it as an option with a strong warning of what might happen, and that they should back-up first before attempting an upgrade-conversion.

fplanque wrote:

3) should we convert all language packs to UTF-8 or at least have an UTF-8 version for each?

IMO, all language packs must be UTF-8. With non-unicode version as an "alternative option".

fplanque wrote:

4) should we actually discard any language packs that are not UTF8 ?

Same as #3 above.

fplanque wrote:

5) should we make b2evo use UTF8 internally by default, although about 40% to 60% (not really sure yet) of the servers out there do not have the MB_STRING extension installed and therefore will not be able to handle NON ASCII text properly. That means if you blog in english you don't really care about not having MB_STRING, but if you blog with non ascii chars you may need to battle with your host or even switch to another host just to get mb_string.

Probably by now, 2009, more servers are supporting Unicode across the board, since it is now the thrust by almost all websites and CMS/Blogs platforms today. It also makes translations easier and well, if one wants to capture non-English end-users, then that platform and server must support Unicode.

fplanque wrote:

What do you think?

Change b2evolution, starting from v3.0 to use Unicode by default. From the posts/locale, to the DB-table creation, to the DB Connection, to the files (php/html/css) being saved as UTF-8 (however, no BOM [BOM is required only on UTF-16 and UTF-32]).

When it comes to locale/translations, the main thrust of all language packs from b2evo v3 should be unicode, particularly UTF-8 (IMO, we dont really need UTF-16 and UTF-32 yet). If there is a request of a non-unicode language pack, then that's the only time that version should be provided - with a specific note that it is better to use Unicode today.

Finally, b2evolution will be able to capture more users in non-English nations like China, Japan, and Korea - where blogging is huge - surpasses the rest of the world combined. (Okay, I maybe exaggerating :p )

2010 May 29 15:30

thank you very much Laibcoms.
*edit : spammers are so unimaginative, your crap removed

2011 Dec 28 01:27

What is the correct way of setting b2evolution to use utf-8 these days (4.1.2)?

I recently had to rebuild my b2evo install and I went to do the typical settings such as:

PHP

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

But there is this massive warning in the _locales.php file that says:

PHP

/**
 * Set this to a specific charset, to force this as {@link $io_charset I/O charset}, if the browser accepts it.
 *
 * DO NOT CHANGE THIS if your language requires UTF8 (East Asian, Arabic, etc, etc, etc) !!!
 * This is NOT the correct way to do it. If you change this setting it may look like it works but YOU WILL HAVE ISSUES!
 * The correct way to use UTF8 for some languages/locales is to install the appropriate language pack into the locales folder.
 * Language packs can be downloaded here: http://b2evolution.net/downloads/language-packs.html
 *
 * If your language is not available, you can create your own (you may use /locales/ru-RU as a model)
 * OR... WORST CASE SCENARIO: you can always use the en-US-utf8 locale: "English (US) utf8"
 *
 * Please share new language packs with the community.
 *
 * Setting this to "utf-8" allows you to deliver all pages in this encoding even if the selected locale was not
 * translated to utf-8. Typically requires MBSTRING. Make sure, that your PHP/MySQL setup supports this.
 *
 * @global string
 */
$force_io_charset_if_accepted '';

Of course, I tried their recommendations first. I want to use an en-CA locale that is in utf-8 so that I can occasionally type in Chinese.

I made a copy of the existing en-US.utf8.locale.php file in the locales/en_US directory and changed it to be CA and corrected the date format.

I enabled this locale in the global settings and set is as the default and as my blog's default. But after all of that, all my old blog posts still showed as ??? and writing any new Chinese characters had them converted to HTML entities.

At the end, I went back to the old way of changing the encoding settings in the _locales.php file (as specified in the above posts, circa 2007). But according to the new versions of b2evolution, this is very wrong now?

2011 Dec 30 14:10

You need to convert your old database to utf-8. After that just create new locale and activate it, see how Russian locale does it.


Form is loading...

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