Foriegn Characters Again

Post Reply
gerry.odea
Posts: 98
Joined: Fri Sep 19, 2008 9:33 am

Foriegn Characters Again

Post by gerry.odea »

I'm using the code below and it works great, except for foriegn UTF8 characters like Ö (Ö) İ (İ) ĕ (Į)

If I have a user_name like "ÖÖÖÖÖÖ" it won't split it apart properly. Please help. I think I tried about everything to get it to work. Thanks

<rex "." $user_name>
<$letters=$ret>
<a href="/?username=$user_name">
<loop $letters>
<if $letters=" "><$letters=blank></if>
<$colors = blue red yellow green>
<loop max=1 skip=$skipnum $colors>
<if $HTTP_USER_AGENT like "Firefox"><$falign=middle><else><$falign=absmiddle></if>
<if $letters = "/"><$letters = "_forwardslash"></if>
<if $letters = "?"><$letters = "_questionmark"></if>
<if $letters = ">"><$letters = "_greaterthan"></if>
<if $letters = "<"><$letters = "_lessthan"></if>
<if $letters = ">"><$letters = "_greaterthan"></if>
<if $letters = "<"><$letters = "_lessthan"></if>
<if $letters = "."><$letters = "_period"><$falign=bottom></if>
<if $letters = ":"><$letters = "_colon"></if>
<if $letters = "*"><$letters = "_asterik"><$falign=top></if>
<if $letters = "\"><$letters = "_backslash"></if>
<if $letters = "|"><$letters = "_pipe"></if>
<if $letters = "%"><$letters = "_percent"></if>
<if $letters = "_"><$falign=bottom></if><if $letters = ","><$falign=bottom></if><if $letters = "g"><$falign=bottom></if><if $letters = "j"><$falign=bottom></if><if $letters = "p"><$falign=bottom></if><if $letters = "q"><$falign=bottom></if><if $letters = "y"><$falign=bottom></if>
<if $letters = "^"><$falign=top></if><if $letters = "'"><$falign=top></if><if $letters = "b"><$falign=top></if><if $letters = "b"><$falign=top></if><if $letters = "d"><$falign=top></if><if $letters = "f"><$falign=top></if><if $letters = "h"><$falign=top></if><if $letters = "k"><$falign=top></if><if $letters = "l"><$falign=top></if><if $letters = "i"><$falign=top></if><if $letters = "t"><$falign=top></if>
<if $letters = "A"><$falign=top></if><if $letters = "B"><$falign=top></if><if $letters = "C"><$falign=top></if><if $letters = "D"><$falign=top></if><if $letters = "E"><$falign=top></if><if $letters = "F"><$falign=top></if><if $letters = "G"><$falign=top></if><if $letters = "H"><$falign=top></if><if $letters = "I"><$falign=top></if><if $letters = "J"><$falign=top></if><if $letters = "K"><$falign=top></if><if $letters = "L"><$falign=top></if><if $letters = "M"><$falign=top></if><if $letters = "N"><$falign=top></if><if $letters = "O"><$falign=top></if><if $letters = "P"><$falign=top></if><if $letters = "Q"><$falign=top></if><if $letters = "R"><$falign=top></if><if $letters = "S"><$falign=top></if><if $letters = "T"><$falign=top></if><if $letters = "U"><$falign=top></if><if $letters = "V"><$falign=top></if><if $letters = "W"><$falign=top></if><if $letters = "X"><$falign=top></if><if $letters = "Y"><$falign=top></if><if $letters = "Z"><$falign=top></if>
<img src="/i/letters/spacer.gif" border=0 height="64" width="1"><fmt '<img src="/i/letters/glike/%s%s.gif" border=0 alt="%s" align="%s" style="vertical-align: %s">'$colors $letters $user_name $falign $falign>
<$skipnum=$next>
<if $skipnum = 4><$skipnum=0><$next=0></if>
</loop></loop></a>

I am using Commercial Version 2.6.929642470
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Foriegn Characters Again

Post by mark »

Rex works at the byte level. Your scheme won't work for multibyte characters. You need to write an expression(s) to match all of the bytes in a multibyte character.
gerry.odea
Posts: 98
Joined: Fri Sep 19, 2008 9:33 am

Foriegn Characters Again

Post by gerry.odea »

Can you start me off in that? So I have a template. Please
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Foriegn Characters Again

Post by mark »

Using these 2 expressions in one rex should give you utf-8 characters instead of only bytes:

">>[\xc0-\xfd]=[\x80-\xbf]+"
"[\x00-\x7f]"
gerry.odea
Posts: 98
Joined: Fri Sep 19, 2008 9:33 am

Foriegn Characters Again

Post by gerry.odea »

So it would be

<rex ">>[\xc0-\xfd]=[\x80-\xbf]+" "[\x00-\x7f]" $user_name>


it says 3442: Wrong number of arguments to user function `rex' (expected 2)
gerry.odea
Posts: 98
Joined: Fri Sep 19, 2008 9:33 am

Foriegn Characters Again

Post by gerry.odea »

<$expr = ">>[\xc0-\xfd]=[\x80-\xbf]+" "[\x00-\x7f]">
<rex $expr $user_name>

like this it works! Thanks Mark!
Post Reply