Closed (fixed)
Project:
Boost
Version:
6.x-1.11
Component:
Internationalization
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Oct 2009 at 20:08 UTC
Updated:
28 Oct 2009 at 09:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
mikeytown2 commentedWas this a problem with Boost 1.03, or is this a new install? You want to save in utf-8 correct?
Is there any way to detect win-1251?
Possible Solutions Today:
http://php.net/utf8-encode before saving file
http://php.net/iconv to convert it
http://php.net/utf8-encode#74905 - Example
Possible Solutions With PHP 6.0:
http://php.net/stream-encoding
http://php.net/file-put-contents with the FILE_TEXT
Comment #2
mikeytown2 commentedYou can play around with what is written to the cache by implementing this hook
hook_boost_preprocess()
Comment #3
Martynov-1 commentedThank you for reply. Here are the answers to your questions:
1) I used 6.x-1.11 version of Boost.
2) yes, I want to save the cached files in utf-8.
3) Sorry, but I don't understand this question. What exactly do you mean?
Maybe I am wrong, but I think that the problem happens exactly in the moment of writing the data to the server (not at the moment of writing the data to the cache). And maybe this is the problem of server setup. Which php function is used to write the files to the server? Maybe Boost can save the files in specific charset (utf-8)? Can I force Boost to do it?
Comment #4
Martynov-1 commentedBy the way, what function name should I use in my theme template.php file to override hook_boost_preprocess function of Boost module - hook_boost_preprocess, mytheme_hook_boost_preprocess or mytheme_boost_preprocess?
Comment #5
mikeytown2 commentedmytheme_boost_preprocess() should do the trick
PHP6 allows for saving files in a specific charset. Boost uses file_put_contents() to save the cached file.
What if I make the default so Boost always saves in utf-8. Could you see any issues with that?
Comment #6
Martynov-1 commentedHello, mikeytown2! I am almost sure this will solve my problem. Please make this improvement in the Boost module. I hope it will not take a lot of your time. I look forward to hearing from you about the new version or patch including this new feature. Thank you.
Comment #7
mikeytown2 commentedComment #8
Martynov-1 commentedHello, mikeytown2. I installed your patch manually and tested it. Unfortunatently it didn't help. All the files are still saved in win-1251 charset. I phoned to my hosting support. They adviced me to add "AddDefaultCharset Off" line to my .htaccess file, and this solved the problem for now. Although I hope you will find better solution.
Comment #9
mikeytown2 commentedhttp://httpd.apache.org/docs/trunk/mod/core.html#adddefaultcharset
The actual file is not the problem, its your webserver. It's configured to send out win-1251 by default. By turning this off it solves your issue. You could also do this and it would have the same effect.
This is something that I might want to add to the default .htaccess rules, but I'm not 100% certain.
Comment #10
mikeytown2 commentedCould you let me know if adding this to your htaccess file fixes the issue?
Comment #11
mikeytown2 commentedCode patch for above proposed change
Comment #12
mikeytown2 commentedcommitted