luvas2010 / rapyd-framework

Automatically exported from code.google.com/p/rapyd-framework
0 stars 0 forks source link

strlen <> mb_strlen #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I think that the function for comparing strings must be "Multibyte String 
Functions", because when using UTF8 is the wrong comparison.

- strlen
ěščřžýáíé != escrzyaie

- mb_strlen
ěščřžýáíé == escrzyaie

Original issue reported on code.google.com by pva...@volny.cz on 4 Mar 2011 at 12:31

GoogleCodeExporter commented 9 years ago
I use "some" of the mb functions..  and mb_substr the only indispensable (for 
me)
and in the rev.290 i indroduced a back compatibility helper (if mb is not 
installed it define a custom mb_substr that work as native)

http://code.google.com/p/rapyd-framework/source/browse/trunk/core/helpers/compat
.php

I consider this fixed...  here we can add other mb_  and other.. "if not 
installed define" functions

Original comment by felice.ostuni on 14 Jun 2011 at 6:11

GoogleCodeExporter commented 9 years ago
I do not know why, but still control
$edit->field('input','name','Název')->rule('max_length [100]')
does not work correctly.

When I enter text with accents, so the number of characters in the text 
smaller, depending on the number of accented characters in the input text.

If the text without diacritics, so everything is OK.

Original comment by pva...@volny.cz on 21 Jun 2011 at 2:45

GoogleCodeExporter commented 9 years ago
you added a space... correct one is max_length[100].
but ok about strlen (not utf8 safe), we'll use also mb_strlen...  
and probably i'll add a separate file for full utf8  compatibility

Original comment by felice.ostuni on 21 Jun 2011 at 5:17

GoogleCodeExporter commented 9 years ago
The space added there is a gap when copying. In the code that I have written 
without spaces.

Try this test. Set a length of 10 and enter (copy) the following text:

ěščřžýáíéů

and after

escrzyaieu

You'll see that the text will be the first to report an error - string too long.

Original comment by pva...@volny.cz on 21 Jun 2011 at 6:47

GoogleCodeExporter commented 9 years ago
yes, as said in other comments, we'll use  utf8 compatibility layer (like 
http://php-utf8.61924.nl/) and 'strlen'  and other non utf8-safe string 
functions will be replaced in the code.

Original comment by felice.ostuni on 21 Jun 2011 at 10:14

GoogleCodeExporter commented 9 years ago
now we're using utf8_  functions (borrowed from dokuwiki)
so instead mb_  you should use utf8_ prefix for back compatibility

Original comment by felice.ostuni on 29 Oct 2011 at 9:24