0

In following small program I cant figure out why the utext_openUTF8 return with error..

  int utf8_is_it_model3(std::string input_string)
  {
int error_number=0;
UText *ut = NULL;
    UErrorCode status;

    //char *pEnd;
const char * c2 = input_string.c_str();
    ut = utext_openUTF8(ut, c2, -1, &status);
 if(U_FAILURE(status))
 {
            error_number=-1
    std::cout<<" Error!\n";
    return error_number;
 }



utext_close(ut);

 return error_number;

 }   

int main(int argc, char* argv[])
{
int i;
bool is_it_model=false;
std::string input_string="mod-12k";
//std::string input_string="m54-q";
//std::string input_string="- ";
i=utf8_is_it_model3(input_string);

return 0;
    }

output: Error!

when I change the std::string input_string="mod-12k"; with the std::string input_string="sko-w"; I have no error...

I am using ubuntu 64 bit 12.04 and c++ and ICU 49

I cant find out what i am doing wrong...

user1675224
  • 213
  • 2
  • 12

1 Answers1

1

The real problem is you need this on line 5:

UErrorCode status = U_ZERO_ERROR;

Steven R. Loomis
  • 4,228
  • 28
  • 39