Hi,
It used to be just fine until last update, since than i get this all over the pages (debug mode) and boost header is missing, so i guess it is not working anymore.

any ideas what could be the problem?
---------------------------------------------------------------------------
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\x93-25-&...' for column 'message' at row 1.

#0 /home/sabresim/public_html/includes/database/database.inc(2137): PDOStatement->execute(Array)
#1 /home/sabresim/public_html/includes/database/database.inc(664): DatabaseStatementBase->execute(Array, Array)
#2 /home/sabresim/public_html/includes/database/mysql/query.inc(36): DatabaseConnection->query('INSERT INTO {wa...', Array, Array)
#3 /home/sabresim/public_html/modules/dblog/dblog.module(157): InsertQuery_mysql->execute()
#4 [internal function]: dblog_watchdog(Array)
#5 /home/sabresim/public_html/includes/module.inc(795): call_user_func_array('dblog_watchdog', Array)
#6 /home/sabresim/public_html/includes/bootstrap.inc(1675): module_invoke('dblog', 'watchdog', Array)
#7 /home/sabresim/public_html/sites/all/modules/boost/boost.module(1249): watchdog('boost', 'Array
?(
$_REQUEST:
Array
(
    [__utma] => 80321045.1702299927.1320659556.1324893959.1324903157.192
    [__utmz] => 80321045.1324893959.191.32.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=מסעדת הזקן והים
    [Drupal_toolbar_collapsed] => 0
    [Drupal_tableDrag_showWeight] => 0
    [has_js] => 1
    [__utmc] => 80321045
    [EnvoUserInstance47374] => pa00EY4DtlM2tt
    [EnvoEdgeURL47374] => edge3rx3.envolve.com
    [ctools-collapsible-state] => views-ui-advanced-column-things_to_do:1,views-ui-advanced-column-resturants:1,views-ui-advanced-column-lodging:1
    [SESS3716ebe320b01fc2aee2e7ff93c155f4] => j_5HO3ULjyrDbbPkRzcNd2Pf0DO3seFitibYQwLzflE
    [__utmb] => 80321045.8.10.1324903157
)


REQUEST_URI:
/content/10-%D7%A2%D7%93-25-%D7%A9%D7%97/%D7%91%D7%98%D7%91%D7%A2-%D7%91%D7%9E%D7%99%D7%95%D7%97%D7%93-%D7%9C%D7%99%D7%9C%D7%93%D7%99%D7%9D-%D7%92%D7%9F-%D7%97%D7%99%D7%95%D7%A
CommentFileSizeAuthor
#4 boost-utf8-url.patch616 bytesbgm

Comments

imoreno’s picture

Status: Active » Closed (won't fix)

this is related to pathuto + UTF8 url's, noot boost.

bgm’s picture

Status: Closed (won't fix) » Postponed (maintainer needs more info)

Thanks for updating the issue. Could you provide more information about your solution? It might help people who run into the same issue.

Do we need to put a warning in the boost README? (if one day someone writes one)

imoreno’s picture

Currently it does not works with Auto-path when using UTF8 chars in url with RTL support for Hebrew, Arabic. if I disable the search engine friendly url's all is working as expected.

bgm’s picture

Title: last dev is not working for me - PDOException » PDOException with UTF-8 aliases / boost does not cache pages with UTF-8 aliases
Status: Postponed (maintainer needs more info) » Needs review
Issue tags: +i18n, +utf-8
StatusFileSize
new616 bytes

Not sure if it's the same bug, but if I create an alias with non-ascii (French accents or Cyrillic letters), the page is not cached. (I could not reproduce the SQL error)

From what I understand, the URL parsed in Boost is from request_uri(), but that function does not urldecode() the data, so a request to http://www.bidon.ca/привет becomes http://www.bidon.ca/%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82, and the alias cannot be found in the database.

See attached patch.

bgm’s picture

bgm’s picture

trante’s picture

I also has this problem. I installed latest dev (7.x-1.x-dev 2012-Feb-14)

My nodes having non-ASCII characters aren't cached by Boost, but non encoded nodes are cached successfully.

bgm’s picture

@ trante: can you test the patch in #4 ?

trante’s picture

@bgm
Thank you for interest. But the patch didn't help.
Still not caching UTF-8 aliased nodes.

mikeytown2’s picture

Status: Needs review » Needs work

#4 shouldn't do much due to the urldecode loop further down on line #420. I believe the problem is somewhere else; it might have to do with the database not being UTF-8?

bgm’s picture

At line 420, it decodes the url, but stores it in $parts['url_decoded'], and that is barely used.

In my case, e.g. create a page with an alias "testé", I have isolated the issue to the following code:

function boost_transform_url($url = NULL, $b_path = NULL) {
[...]
    // Get the internal path (node/8).
    if (drupal_is_front_page()) {
      $parts['normal_path'] = variable_get('site_frontpage', 'node');
    }
    else {
      $parts['normal_path'] = drupal_get_normal_path($parts['path']); // <- here
    }

In that function, the value of $parts['path'] in my test is "test%C3%A9" (encoded), so Drupal cannot find the path for the page and eventually boost sets $_boost['is_cacheable'] = FALSE; because of that.

However, even if I put a urldecode($parts['path']) for the drupal_get_normal_path(), Boost will generate a cache file for it, but it will be named "test%C3%A9.html". Then Apache cannot find it because mod_rewrite automatically decodes URLs and searches for "testé.html".

My patch in #4 fixes that issue. The only possible caveat with my patch, is that the file name is UTF-8 on the filesystem. Normally, Linux and others should support this fine. I tested successfully with hebrew and cyrillic.

@ imoreno: I'm not sure on the initial bug report though. According to the query, it seems like correct UTF-8, except for the last caracter, %A.. could that be the issue?

imoreno’s picture

Status: Needs work » Reviewed & tested by the community

Thank you BG,
With your patch from #4 all is working as expected!
both my aliased UTF-8 nodes and aliased non UTF-8 nodes are being cashed properly by boost.

I think this can be committed.

BR
Itzhak

bgm’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta1
Status: Reviewed & tested by the community » Fixed

Thanks. Committed to 7.x-1.x d9d912a67c73e89dc86b4f9101fa354929ac4982

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jamix’s picture

#4 doesn't fix the URL encoding issue when there are special characters in the query string (as opposed to URL path). See #1398578: Apache has problem with urlencoded query strings in cached file names

omnia.ibrahim’s picture

Do you have a patch for boost version 6 ? As am having the same problem with arabic characters generated from pathauto.

Anonymous’s picture

Boost 6 is much more complex than 7 and has some advanced options that you might need to test first

BOOST_SET_FILE_ENCODING

is under one of them and at line 3722 in boost.module there is already a character conversion

    if (BOOST_SET_FILE_ENCODING != '') {
      $name = iconv("UTF-8", BOOST_SET_FILE_ENCODING, $name);
    }

the main question would be as to which format the url string is in at this point, whether the arabic characters are urlencoded or not, but the patch for 7 was quite simple and added a urldecode if you are getting characters in the cached filenames like %D0 then it probably needs adding just after that point.

omnia.ibrahim’s picture

Thanks Philip, but i can't get what do you mean by "BOOST_SET_FILE_ENCODING"?

Now my problem is that any page with arabic url is not cached at all, no file is created for it.

Anonymous’s picture

I only came to the project after 7 had been released so don't have a 6 installation to hand at the moment.

Having looked through the 6 source code there appears to be an advanced option that should be set somewhere in the boost admin options where you can change the character set. The character set conversion starts when it is set to something other than UTF-8 and may not be what is needed (it's very difficult to tell as an english person with everything set up for European characters), probably to debug it you need to find out what is going in and coming out of the boost.module function (Approx. line 4416)

function boost_get_all_filenames($filename, $base_dir = NULL) {

by printing it to a text file in the cache folder, although it may not be precise as your text editor may handle the characters differently (I recently had quite a problem with Thai characters cut and pasted into a text box then submitted to a database with columns in latin-1 and the output was haphazard across web pages and the terminal) .

The first stage does seem to be working out if what is going into the function is undergoing any kind of conversion, then what the conversion should be. I suspect a urldecode needs to be placed in that function although I can't hazard a guess as to whether it is to be placed early or late as there is code in there to remove special characters that the file system cannot handle. It's also probably worth examining the table boost_cache in the database as there is a column for the filename that boost 6 thinks it is storing.

omnia.ibrahim’s picture

Now when i changed the value in BOOST_SET_FILE_ENCODING to cp1256 (for arabic), the files are saved but with wrong encodings + not retrieved back correctly, any idea how to fix it?

Anonymous’s picture

Does this mean that your file name are being saved with the correct arabic alphabet because that's rather interesting if that is happening.

You could enable RewriteLog and RewriteLogLevel to see what files apache is looking for http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

omnia.ibrahim’s picture

Noo the files are saved with wrong encoded characters, not arabic

Anonymous’s picture

That's not so good then, but at least something was saved. I'd suggest reverting back to UTF-8 and then under that section in boost module doing a url decode and seeing if it saves out a file.

omnia.ibrahim’s picture

yessssssssss workeddddd thanksssssssssssssssssssssssss :))))))