Forum Discussion

Aaron_6309's avatar
Aaron_6309
Icon for Nimbostratus rankNimbostratus
Jul 02, 2012

iRule with special characters

I'm trying to create a redirect rule for the root folder educação after my TLD.

 

 

 

 

I've tried the following iRules but neither seem to take

 

 

 

elseif { [string tolower [HTTP::uri]] equals "/educa%C3%A7%C3%A3o" } {

 

HTTP::redirect "http://website"

 

}

 

 

 

 

and

 

 

 

elseif { [string tolower [HTTP::uri]] equals "/educação" } {

 

HTTP::redirect "http://website"

 

}

 

 

 

 

Is there any way to get unicode characters to work in an iRule?

 

 

 

Thanks!

 

1 Reply

  • It seems TCL converts "/educação" to "/educação" if used when storing the string in a variable or comparing in an if statement.

     

     

    I got around the issue by doing this:

     

     

    when HTTP_REQUEST {

     

    log local0. "Path = [HTTP::path]"

     

    if { [string compare "educação" [HTTP::path]] } {

     

    log local0. "You win!"

     

    }

     

    HTTP::respond 200 Content "Cool" Connection "Close"

     

    }

     

     

    LTM log:

     

     

     

    Jul 3 19:05:46 tmm info tmm[24581]: Rule /Common/Test4 : Path = /educação

     

    Jul 3 19:05:46 tmm info tmm[24581]: Rule /Common/Test4 : You win!