Ver Mensaje Individual
  #2 (permalink)  
Antiguo 09/06/2009, 06:28
chikymb
 
Fecha de Ingreso: junio-2009
Mensajes: 2
Antigedad: 15 aos, 7 meses
Puntos: 0
Respuesta: SQLite y Unicode

Buenas he solucinado el problema de una forma un tanto bruta, pero en fin al no ser muchos datos funiciona.

He escrito dos funciones, una que pasa los caracteres extraos a etc y otra que pasa los acentos a cartacteres extraos para hacer comparaciones con la BD

al parecer los caracteres con acentos los dibide en en 2 char, y el primero siempre es as que me ayudo de esto para hacer las comprobaciones.

// Á á É é Í * Ó ó Ú ú Ñ ñ Ü ü
//
char * CUtilString::ConvertStringToCharUnicode(CString strString)
{
char *cadena;

cadena = (char *)malloc(strString.GetLength()*sizeof(char)+1);
int i = 0, z = 0;
for( i = 0; i < strString.GetLength();i++)
{
if ((char)strString.GetAt(i) == ''){
i++;
if ((char)strString.GetAt(i) == '')
cadena[z] = '';
else if((char)strString.GetAt(i) == '')
cadena[z] = '';
else if((char)strString.GetAt(i) == '')
cadena[z] = '';
else if((char)strString.GetAt(i) == '')
cadena[z] = '';
else if((char)strString.GetAt(i) == '')
cadena[z] = '';
else if((char)strString.GetAt(i) == '*')
cadena[z] = '';
else if((char)strString.GetAt(i) == '')
cadena[z] = '';
else if((char)strString.GetAt(i) == '')
cadena[z] = '';
else if((char)strString.GetAt(i) == '')
cadena[z] = '';
else if((char)strString.GetAt(i) == '')
cadena[z] = '';
else if((char)strString.GetAt(i) == '')
cadena[z] = '';
else if((char)strString.GetAt(i) == '')
cadena[z] = '';
else if((char)strString.GetAt(i) == '')
cadena[z] = '';
else if((char)strString.GetAt(i) == '')
cadena[z] = '';
}
else
cadena[z] = (char)strString.GetAt(i);

z++;
}
cadena[z] = NULL;

return cadena;
}

//Á á É é Í * Ó ó Ú ú Ñ ñ Ü ü
//
char * CUtilString::ConvertStringToUTF8Char(CString strString)
{
char *cadena;

cadena = (char *)malloc(strString.GetLength()*sizeof(char)+1);
int i = 0, z = 0;
for( i = 0; i < strString.GetLength();i++)
{
if ((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '*';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else if((char)strString.GetAt(i) == ''){
cadena[z] = '';
z++;
cadena[z] = '';
}
else
cadena[z] = (char)strString.GetAt(i);

z++;
}
cadena[z] = NULL;

return cadena;
}