Announcement

#1 2020-04-23 16:43:23

exogadget
Member
2020-04-20
8

Cyrillic and other unconventional letters in name of symlinked gallery

Hello/Hi/Greetings,

so friends, after few hours surfing the forum and google I see that Piwigo doesn't work with non-English letters in the file/folder names, am I right? I would much appreciate you if you correct my belief.

What is my problem exactly?
I have a lot of folders (and some files) on my NAS Synology (tested not only on Synology but on usual Windows folder) with Cyrillic letters in the names. I vote for English naming, but not only me use these folders. Rename all of them is not proper solution, better I'll find another soft.

These folders are symlinked (mount --bind) to "gallery" folder of Piwigo. When I try to sync them I've got the message:
"[./galleries/photoalbum/день_рожденья] PWG-UPDATE-1 (wrong filename)"

I tried to add this param to config.inc.php in /local/config/ but without success, the problem wasn't solved:
$conf['sync_chars_regex'] = '/^[[:alpha:][:digit:]-_.\sйцукенгшщзхїфівапролджєячсмитьбюЙЦУКЕНГШЩЗХЇФІВАПРОЛДЖЄЯЧСМИТЬБЮёЁъЪыЫэЭ!\(\)\&\/\°\'\,]+$/';

If I create Cyrillic album in Piwigo, of course, it works properly, as physically it isn't Cyrillic folder in structure, just a name in DB.

Do you know any solution?

Piwigo version: 2.10.2
PHP version: 7.3.11
MySQL version: 5.5.62-MariaDB
Piwigo URL: http://sorry it's closed for all

Offline

 

#2 2020-04-23 17:47:33

Zentalquabula
Member
2014-05-10
217

Re: Cyrillic and other unconventional letters in name of symlinked gallery

Operating system? What locale settings do you have? I assume Piwigo like all modern software requires UTF-8 in the file system.

Offline

 

#3 2020-04-24 11:27:53

exogadget
Member
2020-04-20
8

Re: Cyrillic and other unconventional letters in name of symlinked gallery

Zentalquabula wrote:

Operating system? What locale settings do you have? I assume Piwigo like all modern software requires UTF-8 in the file system.

Yes, there is UTF-8, all folders were created in Windows 10 and local is Ukrainian which is very similar to Russian.

Offline

 

#4 2020-04-24 13:20:19

erAck
Only trying to help
2015-09-06
2026

Re: Cyrillic and other unconventional letters in name of symlinked gallery

As $conf['sync_chars_regex'] is used with the PHP preg_match() function you may have to append the u modifier to make that work. Make sure the editor you use writes file content in UTF-8 encoding and that the web server process also runs in UTF-8 locale context. It might also unlikely be your PHP wasn't compiled with UTF-8 for PCRE, in that case prepend a (*UTF8) to the regex. You can also try to express the Cyrillic characters as Unicode code points, e.g. й would be \x{0439} and so on. Instead of listing each individually you can also use a range, e.g. \x{0439}-\x{044E} or whatever suits there.
See https://www.php.net/manual/en/function.preg-match.php


Running Piwigo at https://erack.net/gallery/

Offline

 

#5 2020-04-27 14:06:31

exogadget
Member
2020-04-20
8

Re: Cyrillic and other unconventional letters in name of symlinked gallery

These modifications didn't solve the issue.

setlocale(LC_ALL, 'ru_RU.UTF-8');
setlocale(LC_NUMERIC, 'C');
$conf['sync_chars_regex'] = '/^[[:alpha:][:digit:]-_.\s\x{0410}-\x{044F}\(\)\&\/\°\'\,]+$/';


I'm sorry, I'm not good in PHP, what did I do wrong?

Offline

 

#6 2020-04-28 00:30:32

erAck
Only trying to help
2015-09-06
2026

Re: Cyrillic and other unconventional letters in name of symlinked gallery

The actual Cyrillic script Unicode range is larger than just \x{0410}-\x{044F} so probably you're missing characters there. For example these characters of your previous expression are not in that range:
ЁЄІЇёєії
which are 0x401 0x404 0x406 0x407 0x451 0x454 0x456 0x457
There are several Cyrillic script blocks (i.e. also Supplement, Extended-A,-B,-C), you seem to use range U+0400 to U+045F of the block U+0400 to U+04FF, see https://r12a.github.io/uniview/?block=cyrillic

You can test your expression against single file names at https://regex101.com/ with the PCRE (PHP) flavor.

Btw, the \ backslash escape for the single characters \(\)\&\/\°\'\, is not needed in the character list, except for the / forward slash, it just makes the expression less readable. That could be  ()&°',\/  instead.


Running Piwigo at https://erack.net/gallery/

Offline

 

#7 2020-06-10 12:12:39

exogadget
Member
2020-04-20
8

Re: Cyrillic and other unconventional letters in name of symlinked gallery

erAck wrote:

The actual Cyrillic script Unicode range is larger than just \x{0410}-\x{044F} so probably you're missing characters there. For example these characters of your previous expression are not in that
...
Btw, the \ backslash escape for the single characters \(\)\&\/\°\'\, is not needed in the character list, except for the / forward slash, it just makes the expression less readable. That could be  ()&°',\/  instead.

Done! Thanks much, erAck!

But I did some additional steps:
1) set collation to utf8mb4_unicode_ci for DB;
2) config.inc.php was changed with:

setlocale(LC_ALL, 'ru_RU.UTF-8');
setlocale(LC_NUMERIC, 'C');
$conf['sync_chars_regex'] = '/^[[:alpha:][:digit:]\_.\s\x{0400}-\x{04FF}()&\/°\',!\-]+$/u';

'u' at the end, \- and \' were the stumbling stones.

Now everything works fine.

Offline

 

#8 2020-06-10 18:02:54

erAck
Only trying to help
2015-09-06
2026

Re: Cyrillic and other unconventional letters in name of symlinked gallery

Btw, you should remove the \' apostrophe, at least with directory names it does not work and may or may not (or only partially) work with file names, see [Forum, topic 30356] Directory Names with ' in.


Running Piwigo at https://erack.net/gallery/

Offline

 

#9 2020-06-10 20:01:38

exogadget
Member
2020-04-20
8

Re: Cyrillic and other unconventional letters in name of symlinked gallery

This sign is used in Ukrainian, e.g. Кам'яна, say frankly that isn't a real apostrophe, but thank for your help!
This char could be used in FS file naming.

Offline

 

#10 2020-06-10 23:01:36

erAck
Only trying to help
2015-09-06
2026

Re: Cyrillic and other unconventional letters in name of symlinked gallery

Nevertheless the character you used is
U+0027 ' APOSTROPHE
however the context might be in your language. The apostrophe does confuse some processing hence should not appear in the regex.


Running Piwigo at https://erack.net/gallery/

Offline

 

#11 2020-06-12 08:24:15

exogadget
Member
2020-04-20
8

Re: Cyrillic and other unconventional letters in name of symlinked gallery

You're right. It causes. Checked on filenames with \'. Excluded it from naming.

Offline

 

#12 2022-12-17 17:31:17

Viva
Member
2022-02-08
2

Re: Cyrillic and other unconventional letters in name of symlinked gallery

Guys, I've faced with the same problem. I've made all the recommendations, but sync works strange.
For example 
I have album "2002/Дорога домой" (2002 is a top level album)
Synchronisation add this album with no errors, but when I open it in album it called "2002/ домой"
It removes first Cyrillic word. And if I try to sync it next time it removes this album and then add it one more time. And the situation repeats.

If I put any digit or symbol before Cyrillic word - everything is like a charm.

What should I do?

p.s. Piwigo 13.4.0

Last edited by Viva (2022-12-17 17:31:56)

Offline

 

#13 2023-02-15 12:41:01

a33mail2013
Member
2023-02-15
4

Re: Cyrillic and other unconventional letters in name of symlinked gallery

exogadget wrote:

Done! Thanks much, erAck!

But I did some additional steps:
1) set collation to utf8mb4_unicode_ci for DB;
2) config.inc.php was changed with:

setlocale(LC_ALL, 'ru_RU.UTF-8');
setlocale(LC_NUMERIC, 'C');
$conf['sync_chars_regex'] = '/^[[:alpha:][:digit:]\_.\s\x{0400}-\x{04FF}()&\/°\',!\-]+$/u';

'u' at the end, \- and \' were the stumbling stones.

Now everything works fine.

[s]I've made the same steps, DB itself and all tables are utf8mb4_unicode_ci now.
But Piwigo can't even add a standalone pic outside cyrillic named folder.
[/s]

My fault. Apologies for my post.
Everything works fine now and no need to change collation to utf8mb4_unicode_ci for DB
Piwigo 13.5.0
Installed on 14 February 2023, 14 hours ago
Operating system: WINNT - Windows 7 x64
PHP: 7.4.33
MySQL: 5.5.27
Graphics Library: GD bundled (2.1.0 compatible)

Last edited by a33mail2013 (2023-02-16 22:25:43)

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact