View attachment.

The newest beta messes up the showing of national characters.
Høstferie is displayed as høstferie.
This makes the galleries unviewable.
Tried fixing it with cleaning cache and running cron.

Comments

ncy’s picture

i haven't tested on an international system. are characters like that normally allowed in URL paths?

lomz’s picture

Drupal do not have any trouble with it, neither did Fast Gallery until last version.

ncy’s picture

i noticed in your screenshot that the thumbnails aren't displaying as well. were the pictures linked correctly and thumbnails displayed in the older version? (which older version, btw?)

there are problems with having international characters in the URL path, and all folders/files are stored by path. but i dont have an international system, so i don't really know how things behave.

UPDATE: ok, i've been messing around with mb_convert_encoding (if you recall, we added this in because some ppl reported special characters weren't being saved to the database). but i guess that's causing other problems. i'll post up a new test version soon. what encoding are you using btw?

ncy’s picture

StatusFileSize
new46 KB

hi lomz:

try the attached version. you may want to uninstall the old version first, as i took out the option for renaming files so uninstalling will delete the variable.

this version converts between ISO-8859-1 and UTF-8 encoding. it works for me for special characters in the path, filename, and EXIF data.

not sure how nicely that plays with an international system, so post back and let us know!

:)

cheers,

-nick

lomz’s picture

The other thumbnails didnt show because I removed them for the screenshot, the whole point for me to have a gallery is to show off private photos to people with a password so I would be kind of stupid to show them of here ;)

With your test the galleries are working but the text is still shown as høstferie instead of høstferie.
So you are almost there.,

ncy’s picture

what encoding/system are you using?

lomz’s picture

UTF-8, as standard for Drupal.

ncy’s picture

i mean, what is the default encoding of your location. the code i posted above converts between UTF-8 and ISO-8859-1 (my encoding) to process the paths, and it works fine for me b/c well, i'm in ISO-8859-1 location ...

can you execute the php code in a page and tell me what you get for output?

<?php
  var_dump(iconv_get_encoding('all'));
?>

for example, i get:

array(3) { 
  ["input_encoding"]=>  string(10) "ISO-8859-1" 
  ["output_encoding"]=>  string(10) "ISO-8859-1" 
  ["internal_encoding"]=>  string(10) "ISO-8859-1" 
} 

ncy’s picture

UPDATE:

add this line in fast_gallery.module, line 757 and let me know if that works any better:

      $caption = mb_convert_encoding($caption, 'UTF-8');

add it after:

      // Now grab the directory that this folder should link to
      $current_folder_ar = arg();
      for ($i = 0; $i < _fast_gallery_get_alias_count(); ++$i)
        array_shift($current_folder_ar);
      $current_folder_ar[] = $folder_path_elt;
      $folder_link = implode('/', $current_folder_ar);

      $folder_link = str_replace(' ', '_', $folder_link);

      // Grab the folder name to label it, as the caption
      $folder_name = end(explode('/', $value->folder));
      $caption = str_replace('_', ' ', $folder_name);

      // ****PUT THAT LINE HERE
lomz’s picture

Output:

array(3) { ["input_encoding"]=>  string(10) "ISO-8859-1" ["output_encoding"]=>  string(10) "ISO-8859-1" ["internal_encoding"]=>  string(10) "ISO-8859-1" } 

Update:
That didnt do the trick.:(

ar-jan’s picture

Confirm error. This used to work (3.1beta1). I have some photo's with ñ, which were not a problem before.

Also, I get these errors on the general settings page for fast gallery (not every time, but it seems after changing a setting and saving, or something like that):

# warning: exif_read_data() [function.exif-read-data]: Unable to open file in /sites/all/modules/fast_gallery/fast_gallery.class.php on line 316.
# warning: filemtime() [function.filemtime]: stat failed for album/2008/Piñani.jpg in /sites/all/modules/fast_gallery/fast_gallery.class.php on line 323.

Where "ñ" in the filename would be an "ñ".

ncy’s picture

StatusFileSize
new45.76 KB

ok, regressing to some old code. looks like mb_convert_encoding() can't be used in the file paths, only works on some systems but not others. :P

try this, let me know if special characters still show up in the descriptions/captions.

PS: sorry for all this back-and-forth testing. i don't have a setup where i can simulate international servers/systems.

lomz’s picture

Now it works as it should

ncy’s picture

ok, that's good to hear :). now if i can just find a way to get international characters working on my setup without breaking it for everybody else again .....

ncy’s picture

do the national characters still show up in the image captions in the last version i posted?

lomz’s picture

Yes.

ncy’s picture

StatusFileSize
new46.33 KB

i changed mb_convert_encoding() to utf8_encode() and utf8_decode().

can anybody test this version (with national characters) on a non-u.s. server? also can you report on whether links are working correctly to pictures and to folders? also custom folder thumbnails, and breadcrumb links?

if the names aren't right, try adding this line to fast_gallery.module on line 784:

...
      // Grab the folder name to label it, as the caption
      $folder_name = end($folder_name_ar);
      $caption = $folder_name;

      // THIS LINE
     $caption = utf8_decode($caption);
...

thx .. if this testing gets too long-winded, i might have to just postpone this feature (support for national characters) to not work on all systems.

lomz’s picture

You are almost there.
On the galleries page everything works as it should, both the galleries I have with national characters got thumnails and can be opened.

The problem is now that when opening one of the galleries with national characters the line in the adressfield is showing http://vindstille.net/galleri/h%C3%83%C2%B8stferie not http://vindstille.net/galleri/høstferie as it used to to, and the breadcrumbs got the same error.

ncy’s picture

StatusFileSize
new46.45 KB

ok, new update. i hope we get to the bottom of this :P thanks for all the testing work, lomz.

i don't expect custom folder thumbnails to work yet, with national chars.

totally unrelated note, added 2 more options for Image Caption selection (Copyright and Artist) by request #293857: Image caption not working in thumbnails

lomz’s picture

That doesnt matter, I dont care for setting the folder thumbnail anyway, but give me a notice if you want me to test for it.

Ironicly this fixed the URL-error so this now displays as http://vindstille.net/galleri/besøk_av_Karina_og_Niklas, but the gallerytext is fucked up again, so something inbetween should work.

ncy’s picture

StatusFileSize
new47.19 KB

another update. i tried tracking down the problem, and what i'm guessing right now is that my webhost server doesn't encode to UTF-8 or decode from UTF-8 when accessing the database, because it probably normally doesn't expect national characters.

sooooo, i've included a new setting on the Advanced settings page to toggle that UTF-8 conversion. if one way doesn't work, toggle it off/on and see if that works.

i also worked on getting it to work when national characters are in the gallery path, which seems like it fixed the custom folder thumbnail problem.

also added the option for including images on pages other than the current one (#332873: Pictures on picturepage 2 doesnt show). it seems to work with Thickbox as well

lemme know how this version goes, and i'll start updating the documentation. thx!

PS: a quick side note, remember to refresh your browser, b/c there are changes to the CSS. and in firefox, i had to clear the cache/private data. and again, it's better to uninstall everything in old version first.

lomz’s picture

Now it works in adress-field and caption, but it is wrong in breadcrumbs:

Galleri » høstferie

You are really doing an amazing job.

Ps: #332873: Pictures on picturepage 2 doesnt show is successfully fixed by theese changes.

ncy’s picture

StatusFileSize
new48.47 KB

thanx! :)

whoops, good catch. i was wondering where else i forgot to fix.

one more version, there was some bug in the random image block too that i fixed.

updated documentation.

i also removed some blocks that looked like they were unused code. so let me know if i removed anything important >_<

the test cases i was running into for the special characters was when Clean URLs were toggled on or off. it does some weird things to the links, so that's what i've been testing. lemme know how this version goes ..... other test cases to test might be, with Hierarchy on/off, Imagecache on/off.

-nick

lomz’s picture

Now it works as it should

rapsli’s picture

can anybody else confirm this, so I get check it in.
I think we should make a stable version soon.

rapsli’s picture

Status: Active » Fixed

Created a Beta2 Version.

Keee’s picture

Sorry, I still get titles like this: '?????? ????'
I'm using win xp with windows-1251 encoding

ncy’s picture

did you try toggling the UTF-8 caption conversion on the Advanced settings page?

Keee’s picture

OK, it seems that exif_read_data doesn't work properly on my system

UPD: Now it works fine, but there is no utf8_decode for image captions, so it put it by myself.
Thanx =)

Status: Fixed » Closed (fixed)

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