developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#713 closed bug (fixed)

Bad parsing in jLocale

Reported by: laurentj Owned by: bibo
Priority: normal Milestone: Jelix 1.0.6
Component: jelix:core:jLocale Version: 1.0.5
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

Si il y a un caractère accentué avant un anti-slash, ce caractère est mal interprété

Ne fonctionne pas :

truc = machine à\ toto

Fonctionne :

truc = machine \ à toto

Attachments (3)

713-jLocale-bad-parsing-unit-tests.diff (1.6 KB) - added by Julien 12 years ago.
713-jLocale-bad-parsing-unit-tests.2.diff (2.2 KB) - added by Julien 12 years ago.
updated unit tests to check ISO-8859-1 string too
#713-trunk-badparsing-jlocale.patch (5.5 KB) - added by bibo 12 years ago.
patch with added unit tests

Download all attachments as: .zip

Change History (20)

comment:1 Changed 12 years ago by Julien

  • Status changed from new to assigned

will check that

comment:2 Changed 12 years ago by Julien

  • review set to review?

Hello,

j'ai rajouté un test unitaire, et j'ai pas d'erreur. Mauvais test unitaire ou mauvaise manip de ta part ?

On est bien d'accord que ci-dessus Trac n'affiche pas correctement le retour à la ligne après l'anti-slash, n'est-ce pas, puisque je le vois clairement dans le mail d'alerte de création du ticket :

Ne fonctionne pas :

    truc = machine à\
    toto

 Fonctionne :

    truc = machine \
    à toto

sinon, tu avais peut-être ça sur des fichiers properties non utf-8 ? Je vais tester aussi.

Changed 12 years ago by Julien

comment:3 Changed 12 years ago by Julien

ah ben non, ça passe aussi avec les fichiers en latin-1.... voir le patch mis à jour...

bref, j'attends tes retours avant de chercher plus loin Laurent.

Changed 12 years ago by Julien

updated unit tests to check ISO-8859-1 string too

comment:4 Changed 12 years ago by laurentj

  • review changed from review? to review+

C'est un bug que l'on m'a signalé, je ne l'ai pas vérifié.

Les tests passent dans les deux branches ? trunk et 1.0.x ?

Si oui, les commiter dans les deux branches, et fermer le ticket en INVALID.

Si non, corriger :-)

comment:5 Changed 12 years ago by Julien

  • Resolution set to invalid
  • Status changed from assigned to closed

fonctionne dans les 2 branches, dans lesquelles j'ai mis les test unitaires qui vont bien...

à moins que je me sois arraché (ce qui est tjrs possible ;) ), le bug n'existe pas.

comment:6 Changed 12 years ago by bibo

  • Resolution invalid deleted
  • Status changed from closed to reopened

Unit tests added by Julien fires for me. This bug only occurs under windows it seems.

Reopening bug. I'll take a closer look later.

comment:7 Changed 12 years ago by Julien

something about line endings in the locale file maybe ? I always use "\n"

comment:8 Changed 12 years ago by Julien

which server do you use under windows ? wamp5 ?

comment:9 Changed 12 years ago by bibo

I'm on wampserver php5.2.4 (windows).

Let's sum up what I see. Julien unit test added in ticket #713 do not pass with charset UTF-8 but pass with charset ISO-88591.

After some tests, I was able to spot the failing lines, it is in jBundle.class.php, method _loadResources. regex in PHP have a modifier to deal with UTF-8 string /u. With it Julien unit passes on UTF-8 but no more on ISO-8895-1.

We could add this modifier only if the charset is UTF-8. What are your thoughts ?

Changed 12 years ago by bibo

patch with added unit tests

comment:10 Changed 12 years ago by bibo

  • Owner changed from Julien to bibo
  • review changed from review+ to review?
  • Status changed from reopened to new

Precisely, an UTF8 multiline locale with an accent char before \ would fail the unit test under windows. the accented char is not well parsed. Adding u modifier to matching regex fixes this, but must be used only for UTF-8 charset. See patch attached.

comment:11 Changed 12 years ago by bibo

  • Resolution set to fixed
  • review changed from review? to review+
  • Status changed from new to closed

laurentj gave me r+ on irc. commit done.

comment:12 Changed 12 years ago by Julien

ok checked it works on linux server too.

don't forget to backport it to 1.0.x branch, as I think the bug occurs there too.

comment:13 Changed 12 years ago by bibo

Julien, I don't have the branch checked out so if you have some spare time, please backport my patch.

Otherwise I'll do later.

comment:14 Changed 12 years ago by Julien

I'll do

comment:15 Changed 12 years ago by laurentj

  • Milestone set to Jelix 1.0.6
  • Version changed from trunk to 1.0.5

comment:16 Changed 12 years ago by laurentj

I take it

comment:17 Changed 12 years ago by laurentj

Patch backported. Thanks.

Note: See TracTickets for help on using tickets.