Skip to content

Accents problem for languages other than English #2

Description

@raphxyz

Hello and thanks for your job,

I tried to add a function to change the accented characters into non-accented characters but it does not work.

char* removeAccented( char* str ) {
char *p = str;
while ( (p)!=0 ) {
const char

// "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"
tr = "AAAAAAECEEEEIIIIDNOOOOOx0UUUUYPsaaaaaaeceeeeiiiiOnooooo/0uuuuypy";
unsigned char ch = (*p);
if ( ch >=192 ) {
(*p) = tr[ ch-192 ];
}
++p;
}
return str;
}

`
int RConThread::read()
{
int res= command("GetChat");

if (!res && strlen(channel->getBuffer()))
{
char *p1, *p2;
p2= removeAccented(channel->getBuffer());

  while (true)
  {
     p1= strchr(p2, '\n');

     if (p1)
        *p1= 0;

     if (strncmp(p2, "SERVER: ", 8))
     {
        int nQueued= 0;

        if (Globals::cfgVerbose)
           tell("-> [%s]", p2);

        for (std::list<RConThread*>::iterator it= threads->begin(); it != threads->end(); ++it)
        {
           if (!Globals::cfgDebug && *it == this)
              continue;

           if (Globals::cfgDebug && *it != this)
              continue;

           Work* w= new Work;
           w->server.assign(map);
           w->message.assign(p2);

           if (*it == this)
              queue.list.push_back(w);
           else
              (*it)->enqueue(w);

           nQueued++;
        }
     }

     p2= p1+1;

     if (!p1 || !*p2)
        break;
  }

}

return res;
}
`

Do you have any idea how I should proceed?
I would also like to filter the admin commands and not send them.

if(p2.contains('AdmCmd') ...

Not knowing well the C ++, I allow you to ask a little help :)

Thank you for your help,
Raph.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions