Announcement

#1 2012-08-27 01:58:03

tplowe56
Member
2012-08-20
15

Special characters - such as "é" - "sync_chars_regex" - not allowed

The code below will not allow "é". I get many errors after syncing.

"$conf['sync_chars_regex'] = '/^[a-zA-Z0-9-_. é\@\'\&\,\!]+$/';

Characters such as this are allowed in Adobe Lightroom, Photoshop, Illiustrator, Encore, Premiere, Picasa etc. I would think that for Piwigo to function in an international arena that special characters would be allowed in file naming. Must every file be renamed before uploading? For European languages this would seem to be an extreme limitation.

I see Piwigo as great open source software with many fabulous features,  but this simple limitation would seem to be a large obstacle for many. The real word operates without such limitations to spelling. i realize that PHP and SQL have many restrictions but most people just want a beautiful gallery, they don't want deal with coding limitations.


I have been working through the limitations to file names in this post, but have received no response to my questions on special characters.
http://piwigo.org/forum/viewtopic.php?id=19881

Good cheers,

Thomas

Offline

 

#2 2012-08-27 04:23:03

tplowe56
Member
2012-08-20
15

Re: Special characters - such as "é" - "sync_chars_regex" - not allowed

OK .. This code did the job. The sync added all photos.

$conf['sync_chars_regex'] = '/^[[:alpha:][:digit:]-_.\sÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ!\(\)\&\/\°\'\,]+$/';

I installed fresh database, and still have this error after sync:



Warning:  [mysql error 1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's.07.12.01.jpg','Dinner at Lowe's.07.12.01','2012-08-26 19:18:25','./galleries/2' at line 137

INSERT  INTO piwigo_images
  (id,file,name,date_available,path,representative_ext,storage_category_id,added_by)
  VALUES('1','Adventure Tour.03.12.01.jpg','Adventure Tour.03.12.01','2012-08-26 19:18:25','./galleries/2012/Mexico/Adventure Tour.03.12.01.jpg',NULL,'2','1')
  , ('2','Adventure Tour.03.12.02.jpg','Adventure Tour.03.12.02','2012-08-26 19:18:25','./galleries/2012/Mexico/Adventure Tour.03.12.02.jpg',NULL,'2','1')
  , ('3','Adventure Tour.03.12.03.jpg','Adventure Tour.03.12.03','2012-08-26 19:18:25','./galleries/2012/Mexico/Adventure Tour.03.12.03.jpg',NULL,'2','1')
  , ('4','Adventure Tour.03.12.04.jpg','Adventure Tour.03.12.04','2012-08-26 19:18:25','./galleries/2012/Mexico/Adventure Tour.03.12.04.jpg',NULL,'2','1')
  , ('5','Adventure Tour.03.12.05.jpg', in /home/content/55/2392255/html/gallery2/include/dblayer/functions_mysql.inc.php on line 770


Warning: Cannot modify header information - headers already sent by (output started at /home/content/55/2392255/html/gallery2/include/dblayer/functions_mysql.inc.php:769) in /home/content/55/2392255/html/gallery2/include/page_header.php on line 105

Offline

 

#3 2012-08-27 04:39:59

tplowe56
Member
2012-08-20
15

Re: Special characters - such as "é" - "sync_chars_regex" - not allowed

Now....unfortunately no photos show at all. Albums are there. Caddie says 339 photos, but all albums empty.

Start over......

Not sure if I will ever master this software.....

Offline

 

#4 2012-08-27 12:06:08

flop25
Piwigo Team
2006-07-06
7037

Re: Special characters - such as "é" - "sync_chars_regex" - not allowed

You can change of gallery software.
You have a ' in the name of the file : this character is not allowed


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#5 2012-08-27 14:39:08

flop25
Piwigo Team
2006-07-06
7037

Re: Special characters - such as "é" - "sync_chars_regex" - not allowed

Just to inform you and let you know you're not alone: I've notified the dev who developed the multi size system, on your previous post.


To get a better help : Politeness like Hello-A link-Your past actions precisely described
Check my extensions : more than 30 available
who I am and what I do : http://fr.gravatar.com/flop25
My gallery : an illustration of how to integrate Piwigo in your website

Offline

 

#6 2012-08-27 15:21:04

rvelices
Piwigo Team
2005-12-29
1960

Re: Special characters - such as "é" - "sync_chars_regex" - not allowed

Some details on special chars:

- ' (apos) and " (quote) - problems with html attributes / url encoding-decoding and database queries - could be corrected with some dev/extensive tests
- space,(,),[,],!,, and = will work from the next release (made a change here http://piwigo.org/dev/changeset/17315 and http://piwigo.org/dev/changeset/17316 )
- &, # - problems with url encoding-decoding - could be corrected with some dev/extensive tests
- accentuated characters - big issues to make it work correctly across all operating systems/file system types/php versions/web server types. Notably the issues are related to character encoding: utf-8 for piwigo php and database versus iso-8859 (how php interacts with the file system). This could be corrected but it requires heavy code changes in core and plugins ...
for more infos on this issue see:
http://stackoverflow.com/questions/1525 … -8-strings
http://www.rooftopsolutions.nl/blog/fil … ng-and-php

Offline

 

#7 2013-07-17 15:24:15

rfreitaz
Member
2013-07-15
12

Re: Special characters - such as "é" - "sync_chars_regex" - not allowed

I used the following configuration and work fine for me:

$conf['sync_chars_regex'] = '/^[(a-zA-Z0-9-_.+&áéíóúàãõ@ )]+$/';

Last edited by rfreitaz (2013-07-17 15:24:35)

Offline

 

#8 2020-11-10 09:51:16

casperse
Member
2020-11-08
12

Re: Special characters - such as "é" - "sync_chars_regex" - not allowed

Do anyone have a update on this in 2020?
I have to use nordic letters and find this post trying to use the:
$conf['sync_chars_regex'] = '/^[[:alpha:][:digit:]-_.\sÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ!\(\)\&\/\°\'\,]+$/';

But that gives me allot of lines saying:
Warning: preg_match(): Compilation failed: invalid range in character class at offset 20 in /config/www/gallery/admin/site_update.php on line 225

(Beacuse of a Piwigo crash I had to rool back, but I would like to know the correct string to use in PHP 7.3.24?

Environment detail:
Styresystem: Linux
PHP: 7.3.24 (Vis info) [2020-11-08 22:22:00]
MySQL: 5.5.5-10.4.16-MariaDB-1:10.4.16+maria~bionic-log [2020-11-08 22:22:00]
Grafikbibliotek: ImageMagick 7.0.10-25

Offline

 

#9 2020-11-10 10:06:16

casperse
Member
2020-11-08
12

Re: Special characters - such as "é" - "sync_chars_regex" - not allowed

Okay this seem to do the trick just adding the ÆÅØ
$conf['sync_chars_regex'] = '/^[(a-zA-Z0-9-_. +&æøåáéíóúàãõ@ )]+$/';

Offline

 

#10 2020-11-10 11:14:33

erAck
Only trying to help
2015-09-06
1497

Re: Special characters - such as "é" - "sync_chars_regex" - not allowed

Offset 20 is the minus hyphen in [:digit:]-_ so that is in a bad position, apparently PHP mistakes it as a range forming with the previous [:digit:] character set. You'd have to move the minus to the beginning or to the end of the expression or after a range set so it can't be mistaken. And do yourself a favour and don't include the \' apostrophe in the regex, or make sure it will never occur in directory names, otherwise it would make things fail.


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

Offline

 

#11 2020-11-10 11:43:02

casperse
Member
2020-11-08
12

Re: Special characters - such as "é" - "sync_chars_regex" - not allowed

Offset 20 is the minus hyphen in [:digit:]-_ so that is in a bad position, apparently PHP mistakes it as a range forming with the previous [:digit:] character set. You'd have to move the minus to the beginning or to the end of the expression or after a range set so it can't be mistaken. And do yourself a favour and don't include the \' apostrophe in the regex, or make sure it will never occur in directory names, otherwise it would make things fail.

This is the default value string:
$conf['sync_chars_regex'] = '/^[a-zA-Z0-9-_. ]+$/';


Sorry kept getting errors reverted back to the simpler one:
$conf['sync_chars_regex'] = '/^[(a-zA-Z0-9-_. +&æÆøØåÅ@ )]+$/';

is this okay, would it be possible to add "&" I really dont want to mess up Piwigo but on the otherhand uploaded pictures from devices do have many different character's in them?
Is there a working example that would include most Western/Nordic characters

Is this the changes you would do?:
$conf['sync_chars_regex'] = '/^[[:alpha:][:digit:]_.\sÀÁÂÃÄÅÆàáâãäåæÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ!\(\)\&\/\°\,\-\,]+$/';

Again thanks for helping me out..... :-)

Offline

 

#12 2022-06-21 17:03:36

jungeljoe
Member
2022-05-28
8

Re: Special characters - such as "é" - "sync_chars_regex" - not allowed

Hi, How dit it go? Did you solve this?

Offline

 

Board footer

Powered by FluxBB

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