HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Translation/encoding breaking the site?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#56084 (In Topic #12186)
Avatar

Fan in action

I tried to install a second copy of ocPortal and connect it to the first one as a sub-site. I put it on a subdomain, with the idea to have a subdomain for every separate language.
So, my main installation is at www.os-dreams.org and I made another one at bg.os-dreams.org
The only thing I managed to do was to change the encoding of both to utf-8 (BTW, I think this should be the default setting - even in English, you have people who want to be able to at least write their own name in their own script…)
So, what happened is now both sites report a PHP error:

An error has occurred
PHP WARNING [2] Wrong parameter count for mb_substr() in /www/os-dreams.net/www/root/sources/symbols.php on line 63 (version: 4.2.2, PHP version: 4.4.8, URL: /adminzone/index.php?page=admin&type=setup)


and:
A system e-mail could not be sent. This error may be preventing staff e-mail notifications, so please contact the staff manually to inform them of the problem.

This shows on every page, so there's nothing I can do (admin doesn't work either, you only get the error displayed). You can't get any content either, the error is shown everywhere…

So, two questions:
- how can I fix it?
- how can I have the second one working in Bulgarian? (I know there's a translation tool, but how do I set up the new language to be the default and ONLY language for the site - there's no language setting anywhere?).


Last edit: by pavka
Back to the top
 
Posted
Rating:
#56088
Avatar

Fan in action

ps I changed the line to:

if (function_exists('mb_substr')) return mb_substr($in,$from);

which removed the error, but is this how the function is supposed to be - I don't know…
Back to the top
 
Posted
Rating:
#56121
Avatar

The only thing I managed to do was to change the encoding of both to utf-8 (BTW, I think this should be the default setting - even in English, you have people who want to be able to at least write their own name in their own script…)

I agree. We've only recently started officially supporting utf-8, after hand-crafting some special code to work around PHP's lack of proper support for it. It'd be a compatibility break, but perhaps for the future, especially if PHP 6 comes out soon (seems that's been in development forever!).

Sorry about the bug here, we must have tested on support for the PHP iconv extension most recently and accidentally broken support for the mbstring extension. Your fix was almost right,

Code

   if (function_exists('mb_substr')) return mb_substr($in,$from,$amount);
Let me know if the ,$amount bit causes a problem but I think that should be there and work.

- how can I have the second one working in Bulgarian? (I know there's a translation tool, but how do I set up the new language to be the default and ONLY language for the site - there's no language setting anywhere?).

Please see the latest few posts in the Launchpad discussion topic in the internationalisation forum. We were going over this, plus there were some other bugs and a fix posted.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#56132
Avatar

Fan in action

Yes, I should have thought to add "$amount" too… I did - no changes (still works :-)).

BTW, there used to be a problem with measuring strings in UTF before - Invision Power Board had this bug, where texts would be cut shorter than intended (i.e. - it should limit to 20 symbols but actually you only get 10), and the last symbol is a question mark where it cut a two-byte symbol in two. This bug disappeared, I'm not sure if they fixed their code or the PHP function was fixed. Haven't noticed such a thing on ocPortal yet.
Back to the top
 
Posted
Rating:
#56134
Avatar

This is because PHP doesn't support unicode, unless you use mbstring, iconv, PHP6 (which is alpha code), or you do what we've done for people without mbstring/iconv which is implement are our own basic utf function library.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: