Closed (fixed)
Project:
Boost
Version:
6.x-1.x-dev
Component:
Internationalization
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
12 May 2010 at 17:20 UTC
Updated:
15 Feb 2012 at 05:39 UTC
Jump to comment: Most recent file
Comments
Comment #1
mikeytown2 commentedrelated but not the solution
#782274: Allow % when using the "Only allow ASCII characters in path" setting - this would allow % to pass the ascii check
Are the files for the hebrew pages being created?
Comment #2
nimi commentedI just checked, the files are being created but they have very weird names:
סגל קבוע_.html
סגל קבוע_.html.gz
I remember this happening with uploaded files that have hebrew names. I had to install the transliteration module to make sure that all uploaded files in Hebrew are saved with english chars otherwise they won't work.
Perhaps Boost can save its utf8 cached files using different file names?
Comment #3
nimi commentedPlease, is there anything I can try to fix this?
Comment #4
nimi commentedI tried renaming the cached file:
סגל קבוע_.html
to its proper name (as seen in the url):
צור_קשר_.html
And it works! Boost served the cached file.
How can I get Boost to generate utf8 files with proper names?
Comment #5
nimi commentedWould it be possible to have the cached filenames transliterated?
Comment #6
mikeytown2 commentedHere's how I get the filename and write it
If you know of someway to write files in php with multi byte names, let me know http://php.net/mbstring.
A quick test to see if its possible is run this code and see what filename it generates.
output should be in the cache directory. This will let me know if I'm converting the input string or something else.
http://php.net/iconv appears to be the function I want if the filename doesn't come out right.
Comment #7
nimi commentedThanks a lot for your reply Mikeytown2.
I tried doing the following:
However, when I did:
Finaly when I did:
Wouldn't it be best to implement the Transliteration module (http://drupal.org/project/transliteration) for non-english pages?
Since this is a common problem when saving attachments in utf8 languages, the Transliteration module solves this.
Any idea how to implement the Transliteration module into Boost?
Comment #8
nimi commentedComment #9
mikeytown2 commentedThe Transliteration module goes from utf-8 to acsii. You want to from utf-8 to your specific language CP1255 (Hebrew). Let me know if the Transliteration module does this but I don't think it does. I believe this will have to be a semi-complex patch to get this working. Do you know if PHP can auto detect the language used?
Comment #10
nimi commentedThe Translation module translates into random English characters. It doesn't really "transliterate", but that is good enough to avoid encoding errors.
I don't think php can detect a language but there is an interesting solution here:
http://code.google.com/intl/en-US/apis/ajaxlanguage/documentation/#Detect
This may be a bit complex to implement though.
Perhaps it would be easiest to have Boost save utf8 chars in ascii? Is this complicated to do?
Comment #11
mikeytown2 commentedI'm pretty sure apache won't serve those the transliterated filenames; or did you test it and it indeed does?
Comment #12
nimi commentedHere's what happens when I insert an attachment with the Transliteration module installed:
I edit a node. In the attachments, I browse and add a Hebrew file:
שלום.pdf
Once the file is uploaded it gets automatcally a new name consisting of some English characters:
kjd_jif_s.pdf
Although there is no real transliteration here because the new filename is meaningless, it works when I try to download it.
Comment #13
mikeytown2 commentedlook at the link in the html, it points to kjd_jif_s.pdf
If the link points to שלום.pdf and apache looks for, and gives you kjd_jif_s.pdf then the Transliteration module idea would work for boost. I'm pretty certain it won't work this way, but I do not do much with i18n so I could be wrong.
If you use the Transliteration module with path auto then you will get the desired effect; no need to do anything with boost.
http://drupal.org/project/pathauto
Comment #14
nimi commentedI checked again, when I upload a Hebrew filename it just gets renamed to an English filename.
The final link points to the English filename.
Thus, No Hebrew is being processed by Apache in this case. Is Apache/PHP even able to save files in utf8 languages?
The Pathauto model saves the Hebrew links in Ascii. So when I enter a Hebrew webaddress it is converted to ascii and then loaded.
The problem is that Boost is trying to save files with utf8 filenames.
Maybe it should save them in Ascii, just like Pathauto does?
Comment #15
mikeytown2 commentedBoost saves the filename as the pathname; so if you use pathauto to rename all your paths the ascii then apache will be able to serve them
Comment #16
nimi commentedFinally found a solution!
This is how you can create files with Hebrew characters in their filenames (Make sure your system LOCALE is set to Hebrew):
Now the only thing left to do is to fix in the Boost module the places where file_put_contents is used.
How do you suggest to doing this?
Comment #17
mikeytown2 commentedFor this change its used in 1 place. Here's a patch just for Hebrew; Let me know it works & I will be making a setting for this.
Comment #18
nimi commentedFixed! Here's how:
Scroll down boost.module until you see:
add the following line right below the function:
And it works for Hebrew urls!
Comment #19
nimi commentedMikey, just saw your post. Yep it works :)
Thanks for all your help!
Comment #20
mikeytown2 commentedComment #21
mikeytown2 commentedShould take hints from http://api.drupal.org/api/function/drupal_convert_to_utf8/6
Comment #22
meatbag commentedsubscribing...
Comment #23
mikeytown2 commentedComment #24
ukrdrupal commented...subscribing...
Comment #25
mikeytown2 commented@ukrdrupal
try the patch
Comment #26
mikeytown2 commentedcommitted
Comment #27
nimi commentedSorry to re-open this issue but there is a problem which I think is related here:
Boost is showing expired pages for pages with Hebrew urls.
Only urls that are in English are cleared when expired.
If I clear the cache manually then everything works.
I tried to do a manual Cron but that didn't help.
Any idea why this is happening?
Thanks,
Nimi
Comment #28
mikeytown2 commentedput it in the wrong location; try this patch
Comment #29
mikeytown2 commentedcommitted
Comment #30
nimi commentedWorked like a charm! Thanks a lot mikeytown2.
Comment #32
xandeadx commentedplease add fix in 7.x version
Comment #33
LiorFil commentedI updated the module to latest dev to overcome the hebrew problem.
It is now showing me the cache status block, which wasn't there before.
it even says that it will expire in 58 minutes and 19 seconds, like it should.
but it also says that: cache/normal/www.mysite.co.il/חדשות_.html Does not exist.
there is no comment at the bottom of the source that says that the page is cached by boost.
any workaround for that?
Comment #34
bgm commentedSince Boost 6.x and 7.x are pretty different, let's keep the issues separate.
Here is a 7.x-1.x issue for this: #1386166: PDOException with UTF-8 aliases / boost does not cache pages with UTF-8 aliases. Please review the patch.
Thanks