New user registration is currently disabled due to spam abuse / Регистрация новых пользователей в настоящее время приостановлена из-за злоупотреблений спаммерами

UTF-8 Ifo file

Report bugs here

UTF-8 Ifo file

Postby tosbaha » Mon Aug 08, 2011 2:27 pm

GoldenDict currently doesn't support ifo file which is encoded in UTF-8. Therefore below code fails

Code: Select all
  if ( f.gets() != "StarDict's dict ifo file" ||
       f.gets().compare( 0, versionEq.size(), versionEq ) )
    throw exNotAnIfoFile();

Basically f.gets gets a string which has also "EF BB BF" therefore check fails.
I currently have minimal information related to GoldenDict and C++ so I can't fix it by myself.

PS: I tried to debug GoldenDict with QT's debugging abilities but except "main" function none of the breakpoints works.
tosbaha
 
Posts: 11
Joined: Mon Dec 27, 2010 12:54 pm

Re: UTF-8 Ifo file

Postby tosbaha » Tue Aug 09, 2011 11:09 pm

I have changed the code like below and it is working for me now. However more professional coder should check for my sloppy coding.

Code: Select all
  if ( QString::fromUtf8(f.gets().c_str()) != "StarDict's dict ifo file" ||
       f.gets().compare( 0, versionEq.size(), versionEq ) )
    throw exNotAnIfoFile();
tosbaha
 
Posts: 11
Joined: Mon Dec 27, 2010 12:54 pm


Return to Bugs

Who is online

Users browsing this forum: No registered users and 6 guests