Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

(upcase ) and locale

Help
vranoch
2011-08-08
2012-11-23
  • vranoch
    vranoch
    2011-08-08

    Hello, I tried the (upcase ) funcion on a locale specific string (e.g. Win 1250) and it does not work correctly.
    1) the function UpcaseFunction seems to fail due to a cast 
    char *osptr, *nsptr;  
    and
    (char) toupper(osptr_)
    I think it should be casted to "unsigned int" since the national characters are above 128, am I right?

    2) When I modified the declaration and the cast, the function does not fail any more but the function islower() returns FALSE to national characters, so they are not converted.

    Did someone meet this? What shoud be done to overcome this?

    Thanks Vranoch_

     
  • Gary Riley
    Gary Riley
    2011-08-28

    If changing the type were to work at all, you'd need to change the type to the same size (from char to unsigned char or signed char). An unsigned int on most (if not all) systems is going to be at least two bytes whereas a char is going to be one byte. What do you mean by the function does not fail any more, but characters aren't converted in your 2nd item? How is that different from your first item where it seems to fail?