From kde-devel Sun Oct 24 14:40:10 2004 From: Richard =?iso-8859-1?q?L=E4rk=E4ng?= Date: Sun, 24 Oct 2004 14:40:10 +0000 To: kde-devel Subject: Re: character encoding question Message-Id: <200410241640.11017.nouseforaname () home ! se> X-MARC-Message: https://marc.info/?l=kde-devel&m=109862891126492 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_K77eBUdcPtfPIQ9" --Boundary-00=_K77eBUdcPtfPIQ9 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Sunday 24 October 2004 16.22, Rolf Magnus wrote: > On Saturday 23 October 2004 21:48, Jason Harris wrote: > > Hello, > > > > I need to add three Swedish cities to KStars (see: > > http://bugs.kde.org/show_bug.cgi?id=3D83125). > > > > However, two of the city names contain non-ascii characters, and when I > > paste their names into the Cities.dat file, they are not being encoded > > properly. What I mean is, other non-ascii characters in the file > > appear as one or more "garbage" characters, but are rendered correctly > > in KStars. When I add these new cities, the non-ascii characters are > > rendered correctly in the Cities.dat file, but are not rendered at all > > in KStars. I hope that makes sense. > > > > Anyway, I have no idea how to encode these non-ascii characters > > correctly in the Cities.dat file. Can anyone give me a clue? > > Set your editor to utf-8. And you should also apply this patch I think, otherwise it will be loaded a= s=20 latin1. Richard L=E4rk=E4ng --Boundary-00=_K77eBUdcPtfPIQ9 Content-Type: text/x-diff; charset="iso-8859-1"; name="utf8-fix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="utf8-fix.patch" Index: ksfilereader.cpp =================================================================== RCS file: /home/kde/kdeedu/kstars/kstars/ksfilereader.cpp,v retrieving revision 1.3 diff -u -p -b -B -r1.3 ksfilereader.cpp --- ksfilereader.cpp 9 Apr 2004 20:32:56 -0000 1.3 +++ ksfilereader.cpp 24 Oct 2004 14:38:29 -0000 @@ -22,7 +22,7 @@ KSFileReader::KSFileReader(QFile& file) { // read the whole file at once. This works well at least for the smaller files. - QString sAll( file.readAll() ); + QString sAll( QString::fromUtf8(file.readAll()) ); // split into list of lines lines = QStringList::split( "\n", sAll ); // how many lines did we get? --Boundary-00=_K77eBUdcPtfPIQ9 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --Boundary-00=_K77eBUdcPtfPIQ9--