...but with that inspiration I did some kind of brute force workaround which seems to work for me, though it appears to be quite ugly.
I am very open for better ideas, especially concerning the performance...
Qt Code:
  1. QString MainWindow::fixUtf8BrokenString(QString text)
  2. {
  3. int index = text.indexOf(QChar(195));
  4. while (index>=0)
  5. {
  6. if (text.count()>++index)
  7. {
  8. int code;
  9. code=text[index].toAscii();
  10. switch (code)
  11. {
  12. case 128: text.replace(QString(QChar(195))+QString(QChar(128)),"À");break;
  13. case 129: text.replace(QString(QChar(195))+QString(QChar(129)),"Á");break;
  14. case 130: text.replace(QString(QChar(195))+QString(QChar(130)),"Â");break;
  15. case 131: text.replace(QString(QChar(195))+QString(QChar(131)),"Ã");break;
  16. case 132: text.replace(QString(QChar(195))+QString(QChar(132)),"Ä");break;
  17. case 133: text.replace(QString(QChar(195))+QString(QChar(133)),"Ã…");break;
  18. case 135: text.replace(QString(QChar(195))+QString(QChar(135)),"Ç");break;
  19. case 136: text.replace(QString(QChar(195))+QString(QChar(136)),"È");break;
  20. case 137: text.replace(QString(QChar(195))+QString(QChar(137)),"É");break;
  21. case 138: text.replace(QString(QChar(195))+QString(QChar(138)),"Ê");break;
  22. case 139: text.replace(QString(QChar(195))+QString(QChar(139)),"Ë");break;
  23. case 140: text.replace(QString(QChar(195))+QString(QChar(140)),"Ì");break;
  24. case 141: text.replace(QString(QChar(195))+QString(QChar(141)),"Í");break;
  25. case 142: text.replace(QString(QChar(195))+QString(QChar(142)),"ÃŽ");break;
  26. case 143: text.replace(QString(QChar(195))+QString(QChar(143)),"Ï");break;
  27. case 144: text.replace(QString(QChar(195))+QString(QChar(144)),"Ð");break;
  28. case 145: text.replace(QString(QChar(195))+QString(QChar(145)),"Ñ");break;
  29. case 146: text.replace(QString(QChar(195))+QString(QChar(146)),"Ã’");break;
  30. case 147: text.replace(QString(QChar(195))+QString(QChar(147)),"Ó");break;
  31. case 148: text.replace(QString(QChar(195))+QString(QChar(148)),"Ô");break;
  32. case 149: text.replace(QString(QChar(195))+QString(QChar(149)),"Õ");break;
  33. case 150: text.replace(QString(QChar(195))+QString(QChar(150)),"Ö");break;
  34. case 152: text.replace(QString(QChar(195))+QString(QChar(152)),"Ø");break;
  35. case 153: text.replace(QString(QChar(195))+QString(QChar(153)),"Ù");break;
  36. case 154: text.replace(QString(QChar(195))+QString(QChar(154)),"Ú");break;
  37. case 155: text.replace(QString(QChar(195))+QString(QChar(155)),"Û");break;
  38. case 156: text.replace(QString(QChar(195))+QString(QChar(156)),"Ü");break;
  39. case 157: text.replace(QString(QChar(195))+QString(QChar(157)),"Ý");break;
  40. case 158: text.replace(QString(QChar(195))+QString(QChar(158)),"Þ");break;
  41. case 159: text.replace(QString(QChar(195))+QString(QChar(159)),"ß");break;
  42. case 160: text.replace(QString(QChar(195))+QString(QChar(160)),"Ã ");break;
  43. case 161: text.replace(QString(QChar(195))+QString(QChar(161)),"á");break;
  44. case 162: text.replace(QString(QChar(195))+QString(QChar(162)),"â");break;
  45. case 163: text.replace(QString(QChar(195))+QString(QChar(163)),"ã");break;
  46. case 164: text.replace(QString(QChar(195))+QString(QChar(164)),"ä");break;
  47. case 165: text.replace(QString(QChar(195))+QString(QChar(165)),"Ã¥");break;
  48. case 166: text.replace(QString(QChar(195))+QString(QChar(166)),"æ");break;
  49. case 167: text.replace(QString(QChar(195))+QString(QChar(167)),"ç");break;
  50. case 168: text.replace(QString(QChar(195))+QString(QChar(168)),"è");break;
  51. case 169: text.replace(QString(QChar(195))+QString(QChar(169)),"é");break;
  52. case 170: text.replace(QString(QChar(195))+QString(QChar(170)),"ê");break;
  53. case 171: text.replace(QString(QChar(195))+QString(QChar(171)),"ë");break;
  54. case 172: text.replace(QString(QChar(195))+QString(QChar(172)),"ì");break;
  55. case 173: text.replace(QString(QChar(195))+QString(QChar(173)),"Ã*");break;
  56. case 174: text.replace(QString(QChar(195))+QString(QChar(174)),"î");break;
  57. case 175: text.replace(QString(QChar(195))+QString(QChar(175)),"ï");break;
  58. case 177: text.replace(QString(QChar(195))+QString(QChar(177)),"ñ");break;
  59. case 178: text.replace(QString(QChar(195))+QString(QChar(178)),"ò");break;
  60. case 179: text.replace(QString(QChar(195))+QString(QChar(179)),"ó");break;
  61. case 180: text.replace(QString(QChar(195))+QString(QChar(180)),"ô");break;
  62. case 181: text.replace(QString(QChar(195))+QString(QChar(181)),"õ");break;
  63. case 182: text.replace(QString(QChar(195))+QString(QChar(182)),"ö");break;
  64. case 184: text.replace(QString(QChar(195))+QString(QChar(184)),"ø");break;
  65. case 185: text.replace(QString(QChar(195))+QString(QChar(185)),"ù");break;
  66. case 186: text.replace(QString(QChar(195))+QString(QChar(186)),"ú");break;
  67. case 187: text.replace(QString(QChar(195))+QString(QChar(187)),"û");break;
  68. case 188: text.replace(QString(QChar(195))+QString(QChar(188)),"ü");break;
  69. case 189: text.replace(QString(QChar(195))+QString(QChar(189)),"ý");break;
  70. case 191: text.replace(QString(QChar(195))+QString(QChar(191)),"ÿ");break;
  71. }
  72. }
  73. index = text.indexOf(QChar(195));
  74. }
  75. return text;
  76. }
To copy to clipboard, switch view to plain text mode