utf-8 to uppercase in Redhat Linux

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Frank Carman
    New Member
    • Oct 2011
    • 1

    utf-8 to uppercase in Redhat Linux

    How can I convert a utf-8 string to uppercase in a Redhat Enterprise 4 server? All cgis are written in C.
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    i never did it, but the thing is if it has mixed up both single byte and multibyte character in the same string, then all you have to do

    is skip the next sequential characters

    here is the code
    Code:
    for(i=0;i<stringlenth;)
    {
     if(c1>=224)
     {
      i=i+3;
     }
     else if(c1>=192)
     {
      i=i+2;
     }
     else
     {
      if(string[i]>='a' && string[i]<='z')
      {
       string[i]=string[i]-('a'-'A');//I forgot the difference;
      }
      i=i+1;
     }
     
    }

    Comment

    Working...