LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-18-2011, 02:35 PM   #1
almatic
Member
 
Registered: Mar 2007
Distribution: Debian
Posts: 547

Rep: Reputation: 67
[Qt] String encoding trouble in gnome


Hi,

I have a little qt frontend to wipe files with secure delete from within filemanagers. It does work from kde-filemanagers and stand-alone, but not from gnome. When I open files over a nautilus action, the filename ends up with a kind of html-encoding (%20 for space and so on). Please see this image to understand what I mean.

http://s3.directupload.net/file/u/22...y83qyk_png.htm

I have tried different encoding conversion functions like QString::latin1 and playing around with the options variables %F and %U with or without quotes. But it's all trial and error since I don't know where this encoding comes from.

Any ideas ?

Here is the relevant code, it's also highlighted in the image.

Code:
void qwipe::init(int argc, char* argv[])
{
    for(int i=1;i<argc;i++)
    {
        QListWidgetItem *newItem = new QListWidgetItem;
        newItem->setText(argv[i]);
        fileView->insertItem(i-1, newItem);
    }
}
 
Old 02-18-2011, 04:41 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hi,

Haven't played w/ Qt in a while, but if memory serves me right
you may want to have a play w/:
setPlainText

So, if you find your strings to contain %something sequences
(so if run under Nauseous) use the method above to convert
your "url" to an actual file-system string.

HIH.


Cheers,
Tink
 
Old 02-19-2011, 01:26 AM   #3
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
First I'd suggest taking your argv[i] and storing into an intermediary QString.
What do you get?
I suspect the problem is there and so you might want to look at QString::fromLocal8Bit(). Possibly look at QTextCodec::codecForLocale()
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
having some trouble w/ K3B and encoding with LAME joker20 Slackware 14 12-27-2009 02:17 PM
Re: Locale problem: Can't convert string from native encoding to 'UTF-8' treotan Ubuntu 1 11-14-2007 08:02 AM
Having Trouble with character encoding amit_usual Ubuntu 2 06-15-2007 12:35 PM
apache encoding trouble koloth Linux - Server 0 10-04-2006 06:38 AM
trouble ripping/encoding mp3 beezlebozo Slackware 4 05-22-2005 11:54 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration