From Wordpress to Serendipity

Having trouble installing serendipity?
Post Reply
crilla
Regular
Posts: 9
Joined: Sat Oct 07, 2006 10:28 pm
Contact:

From Wordpress to Serendipity

Post by crilla »

I have read the install howto and the installation was smooth, But:

Importing from Wordpress must be done in UTF-8 because its written i swedish. Then i got problems with ? instead of the swedish åäö so i send a mail to my hosting service and the told me they are not supporting UTF-8 and bla bla. Can't change it. Thats a fact...

Is it possible to do a dirty hack in some of the Serendipity PHP files? Just Måndag instead of M?ndag? Its only the week days name that got the annoying error.

I good blog engine should be hackable :-)
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post by carl_galloway »

the quick and dirty way would be to open the lang file (folder named lang) for your locale, then where every special character is causing problems, simply change the character from the actual character to the ascii equivalent. Its messy, and not recommended because the lang files are supposed to work but if your host...

Maybe you should change host, I mean not supporting utf-8 seems so 20th century :D
crilla
Regular
Posts: 9
Joined: Sat Oct 07, 2006 10:28 pm
Contact:

I doesnt help

Post by crilla »

I doesnt seem to help because the weekday dont seems to be in the lang file? Its only the week days that's dont work. I can see it in the calendar and the post header. Everthing else looks nice.

The configuration must be somewhere else? Perhaps in the database.

My hosting is one of the largest and i dont seem to be able change their mind. No curl, no imagemagic, no UTF-8. But cheap...

:-)
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post by carl_galloway »

ah. Looking through the s9y files, the calendar is created in functions_calendar.inc.php (include folder) but rendered in your site using the file plugin_calendar.tpl (template folder)

Unfortunately, the weekday name is generated by the php date routine and not by Serendipity so if you wanted to get down and dirty you would most likely have to add an {if} statement to the plugin_calendar.tpl file that translates the standard utf-8 version to your own ascii version.
crilla
Regular
Posts: 9
Joined: Sat Oct 07, 2006 10:28 pm
Contact:

Thanks...

Post by crilla »

Thanks for the help but i guess i have to live with the problem. The character is okey if i dont use the UTF-8 in serendipity administration, but then the import from Wordpress generates "hieroglyphs" instead ?!?

Perhaps RSS import? I dont know, but thanks for the help anyway...
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Thanks...

Post by garvinhicking »

Hi!

The "bad" characters in the date happen, because Serendipity makes use of the locale system of your webserver. When you use UTF-8, serendipity tries to use the locale that has UTF-8 characters.

The best thing for you would be to stick with UTF-8 setup, but edit your language file lang/UTF-8/serendipity_lang_se.inc.php. There look at the first lines and change the "LOCALE" row so that you remove "UTF8" from the locale key names.

Then the dates will be printed with ISO-characters as usual. You will then need to edit the file include/functions.inc.php. There you need to set the $is_win_utf variable to true in the function serendipity_strftime.

Modify this:

Code: Select all

    static $is_win_utf = null;

    if ($is_win_utf === null) {
        // Windows does not have UTF-8 locales.
        $is_win_utf = (LANG_CHARSET == 'UTF-8' && strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? true : false);
    }
to this:

Code: Select all

    static $is_win_utf = true;
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
crilla
Regular
Posts: 9
Joined: Sat Oct 07, 2006 10:28 pm
Contact:

Yeeaah!

Post by crilla »

Yeeaah! Great! Thanks!

I just need to change the funktions file. My lang file didnt include any utf8 lines. Now things beginning to look nice again

http://www.befrielse.org/serendipity/
Post Reply