I am using preg_split, with "u" modifier to split to the characters in php. I have the problem that the newline carriages are not splitted in a single entry, so useing this line:
preg_split('//u',"a töxt
{{image}}", -1,PREG_SPLIT_NO_EMPTY);
I get the following result for example:
Array (
[0] => a
[1] =>
[2] => t
[3] => ö
[4] => x
[5] => t
[6] => { //this line is orginally wrapped and not a space
[7] => {
[8] => i
[9] => m
[10] => a
[11] => g
[12] => e
[13] => }
[14] => } )
If i am encoding the string before for checking the valid chars i get:
Array
(
[data] => töxt
{{image}}
[chars] => {t}{�}{�}{x}{t}{
}{{}{{}{i}{m}{a}{g}{e}{}}{}}
[hex] => {74}{C3}{B6}{78}{74}{0A}{7B}{7B}{69}{6D}{61}{67}{65}{7D}{7D}
[mb_chars] => {t}{ö}{x}{t}{
}{{}{{}{i}{m}{a}{g}{e}{}}{}}
[mb_hex] => {74}{F6}{78}{74}{0A}{7B}{7B}{69}{6D}{61}{67}{65}{7D}{7D}
)
So any idea how to achieve the result.. It is not only the carriage return but it is the most important actually..
It is a requirement to handle also multibyte characters