Jump to content

kathas

Members
  • Posts

    113
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://www.yourse.gr/

Profile Information

  • Gender
    Not Telling

kathas's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You could also tell us the output of the conversion. bin2hex(mb_convert_encoding("^à@kol","ucs-2","utf-8")) // 005e00e00040006b006f006c which is correct ucs-2 big endian.
  2. Actually I think the best way to solve this problem is through template inheritance. Template inheritance allows you to extend templates and replace parts of the parent's content. You can see a very good example in Twig's documentation. It is not necessary though to use twig or any template engine, you can implement similar behavior in plain php templates (although not as good looking). For example one could use anonymous functions to achieve similar block based inheritance. --- Template base.php ---- <?php $main = function($head,$body) { ?> <html> <head> <?php $head() ?> </head> <body> <?php $body() ?> </body> </html> <?php } ?> <?php $head = function () { ?> <style> ... </style> <?php } ?> <?php $body = function () { ?> ... body ... <?php } ?> --- Template derived.php --- <?php include ('base.php'); ?> <?php $head = function () use($head) { ?> <?php $head(); ?> <script> ... </script> <?php } ?> <?php $main($head,$body); ?>
  3. Chances are the input string is not utf-8. I would suggest the following print_r( mb_list_encodings() ); and check if ucs-2 is in the list. If it is then probably the input string is not utf-8.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.