R
R
Ramil2014-10-17 12:24:49
PHP
Ramil, 2014-10-17 12:24:49

How to fix encoding problem in VOLT template engine when using filters?

I'm doing a project on Phalcon. I'm trying to display plain text through the VOLT template engine. I write down the text (Cyrillic) in variables.

class IndexController extends \Phalcon\Mvc\Controller
{
  public function indexAction()
  {
    $this->view->setVar('title', 'Товары');
    $this->view->setVar('header', 'Список товаров');
  }
}

I display variables in the template using the lower filter. I want the text to be displayed in lower case.
<!DOCTYPE html>
<html>
<head lang="ru">
    <meta charset="UTF-8">
    <title>{{ title|lower }}</title>
</head>
<body>
  <h1>{{ header|lower }}</h1>
</body>
</html>

All files are in UTF-8 encoding. Without using the lower filter everything outputs fine. And when using it, Volt translates it into an incomprehensible encoding. The filter normally works with the Latin alphabet, but does not want to with the Cyrillic alphabet. I tried to determine in the decoder what encoding it translates into, but to no avail.
Who faced a similar problem, tell me how to solve?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
_
_ _, 2014-10-17
@AMar4enko

Yes, I suppose he uses the phehesh strtolower, and for Cyrillic you need mb_strtolower. Welcome to hell :D

A
Alex, 2014-10-17
@mr_ko

Isn't it easier to do it with CSS? htmlbook.ru/css/text-transform

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question