Bug Report #3210

Kohana core fails if php file saved in not utf-8 encoding

Added by Alexey Kruchenok about 4 years ago. Updated almost 4 years ago.

Status:ClosedStart date:08/31/2010
Priority:NormalDue date:
Assignee:Woody Gilk% Done:

0%

Category:Core
Target version:v3.0.8
Resolution:invalid Points:

Description

Kohana fails badly with
ErrorException [ 2 ]: htmlspecialchars(): Invalid multibyte sequence in argument ~ SYSPATH\classes\kohana\core.php [ 1355 ]

when php file have comment in national language, and saved in other than utf-8 encoding (in my case is cp1251 standard windows encoding for russia)

as i understand that error is rised when error reporting mechanism tries to display this comment, when i save php in utf-8 everything is fine.

hello.php Magnifier - example of file causing such problems (221 Bytes) Alexey Kruchenok, 08/31/2010 05:22 PM

History

#1 Updated by Jeremy Bush about 4 years ago

Try changing Kohana::$charset

I had a similar problem with incoming emails in unknown charsets.

#2 Updated by Alexey Kruchenok about 4 years ago

in my case change to utf-8 encoding work pretty fine. But i think that "ErrorException [ 2 ]: htmlspecialchars(): Invalid multibyte sequence in argument " is very confusing behavor.

#3 Updated by Isaiah DeRose-Wilson about 4 years ago

  • Subject changed from Cohana core fails if php file saved in not utf-8 encoding to Kohana core fails if php file saved in not utf-8 encoding

#4 Updated by Woody Gilk almost 4 years ago

  • Category set to Core
  • Status changed from New to Closed
  • Assignee set to Woody Gilk
  • Target version set to v3.0.8
  • Resolution set to invalid

Kohana cannot detect these kinds issues and provide more information. You need to ensure that your environment works properly by using a single character set (preferably "utf-8") for all files, as well as input and output. Kohana can help with the input and output, but not much else.

Also available in: Atom PDF