News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

UTF-8 and Mods

Started by ramonsky, September 15, 2010, 01:54:02 PM

Previous topic - Next topic

ramonsky

I have an SMF site which is live and online.

In order to develop a mod, I installed a clean copy of SMF onto an Ubuntu netbook for offline testing over the loopback socket. Everything worked like a dream. I wrote the mod, and the mod installs and uninstalls (and even works) on the offline test system.

So then the next step was to upload and install the freshly minted mod onto the live site. Alas ... problem. The install fails, with errors indincating that files such as Errors.english.php don't exist.

I double-checked, and it turns out there is a difference between the live site and the offline site. The live site has files named Errors.english-utf8.php (etc.), wheras the offline site has the same filenames but without the "-utf8".

The question is - how do I upgrade my offline site to have UTF-8 language files (to match what the live site has)? The UTF-8 readme says: "Go to 'Forum Maintenance' -> 'Convert the database and data to UTF-8'" Unfortunately, that option does not exist. Reading further down the readme, I find a comment which suggests that my site is already in UTF-8 - but if that's true, why do the language files still have the old names?

Should I just ignore that instruction, and proceed with the remaining ones, starting with "You'll be needing a new set of language files..." and ending with "If any of your posts contain HTML entities, you will want to convert those to UTF-8 as well"?

xenovanis

Default english (non utf-8) is the default forum language. It's installed the first time you install a forum. Those files not being present is quite odd, I must say.

You can avoid these errors by uploading the default english languagefiles to the /Themes/default/languages directory. Languagepacks can be found here:
http://www.simplemachines.org/download/?languages

Make sure to pick one for your version of SMF.

If you use utf-8 on your live forum, you'll probably have to manually change the utf-8 languagefiles with the modifications. Some mods do update the utf-8 files, but some don't. You can parse the mod from the modsite here and add the modifications to the required files.

Vice verse, you can place the utf8 languagefiles on your local install and select the utf-8 languagepack as default forum language.
"Insanity: doing the same thing over and over again and expecting different results."

ramonsky

Quote from: xenovanis on September 15, 2010, 03:00:08 PM
Default english (non utf-8) is the default forum language. It's installed the first time you install a forum. Those files not being present is quite odd, I must say.
That explains why I didn't get UTF-8 on my test install.

I guess one of the other admins must have upgraded the live site. It makes sense - UTF-8 is a better choice. (Why limit posters to only 255 characters when you can have all of them?) My preference would be Unicode for everything.

Quote from: xenovanis on September 15, 2010, 03:00:08 PMYou can avoid these errors by uploading the default english languagefiles to the /Themes/default/languages directory.
No, I need to change the test site to match the live site, not the other way round. I guess that means I need to upload the UTF-8 language files to the test site - which is kinda what I'd assumed, but I was just looking for confirmation before doing anything stupid.

Quote from: xenovanis on September 15, 2010, 03:00:08 PMIf you use utf-8 on your live forum, you'll probably have to manually change the utf-8 languagefiles with the modifications. Some mods do update the utf-8 files, but some don't.
This is a mod which I have written. Obviously I can make it update the UTF-8 files. The mod isn't the issue; making my test site use UTF-8 consistently throughout, is.

Quote from: xenovanis on September 15, 2010, 03:00:08 PMVice verse, you can place the utf8 languagefiles on your local install and select the utf-8 languagepack as default forum language.
Thank you very much. It's all starting to make sense now.

So I guess what must have happened is, when I installed SMF locally, I would naturally have told it to use UTF-8 from the beginning - but you're saying that that choice only affects the database, not the language files, and I still have to change the language files by hand.

OK - check - think I got it now. Thank you very much for your quick and helpful response.

xenovanis

Yes, even if the database is on utf8, you still need to manually add the utf8 languagefiles and change the language.

See here for more information:
UTF-8 Readme

Quote
OK - check - think I got it now. Thank you very much for your quick and helpful response.

No problem, let us know if you need more help.
"Insanity: doing the same thing over and over again and expecting different results."

ramonsky

As it happens, I was aware of that link. (Indeed, I cited it in my first post on this thread). The problem was that the readme doesn't explain what to do if the "'Forum Maintenance -> Convert the database and data to UTF-8" link doesn't exist, which was the case for me.

But no worries - too much information is definitely better than too little, and thanks to your clarifications I have now got it all working, and so I have marked the thread as Solved.

Thank you once again for your clear and patient explanations. I am very happy. :)

Advertisement: