A: 

My best guess would be: t.setHtml("<html>&nbsp;</html>");

Nick Presta
+1  A: 

I can't actually see anything in the docs (here) as to whether or not it even supports ampersand items. You might want to test some of the others like "&amp;" or "&lt;".

There is mention of support for a nobr tag so you may be able to get a similar effect with (that's a space between those tags):

QTextEdit t;
t.setHtml("<nobr> </nobr>");
paxdiablo
Nope, that too gives the same accented 'a'.
Girish
Also, I have tried different versions of Qt, from 4.3 to 4.5.1 and all have the same issue.
Girish
Girish
+1  A: 
Krsna
Incidentally, I was wondering whether the problem occurs on Macosx but I don't have access to a Mac to test that. Thanks, for the input.Yeah, looks like the bug is only in the Windows version. I have submitted a bug report, hope they fix it in a new release.
Girish
+2  A: 

Don't know much about the subject, so take this with a grain of salt, but have you tried one of the unicode variants like &#160; or &#8194; or &#8195; ?

I don't use QT myself, but I have had this problem with some documents generated using XML/XSLT. Using &#160; took care of the issue for me.

wcm
I had tried   before without success.But, both     work! Thanks a lot!Is it safe to assume that / will work on other computers too?What do suppose is causing this behaviour? I don't really have a good understanding of i18n/unicode stuff and I am pretty sure I haven't messed with the locale or anything like that.
Girish
Honestly, I don't know about the 8194 or 8195 in other systems. I pretty much work in a MS world :( Sorry.
wcm
Does this mean I get the bounty?
wcm
Yes, but I am not seeing any option to select an answer or to commit the bounty (is it because of my low user points?).
Girish
wcm, will work on other users(English speaking) computers running Windows too?
Girish
Again, I'm sorry I don't know that either. My main work product is for intranet applications. Maybe I don't deserve the bounty. BTW, you should be able to check the checkbox underneath my number of up-votes.
wcm
Hi wcm, I found the problem (please see the update I added to my question). Strange, I don't see the checkbox underneath the up-votes. I remember seeing it before but for some reason it's not showing on this thread. Maybe the mods can select your answer on behalf. Or when the bounty expires tommorow the person with the highest up-votes will get the bounty, which will hopefully be you.BTW, I still think you deserve the bounty, because you got my thought process going. :)
Girish
Actually I think the bounty expired today. So it probably was given to the first person with one vote. Oh well. I'm glad you got your problem solved. That's the important thing :o)
wcm
+1  A: 

I tested it under Windows XP SP3 x32 using Qt 4.5.0 and it worked as expected. Not sure if it could be a problem with your Windows locales or a x64 specific bug although i doubt it.

nmuntz
hmm, odd. I did try it on XP SP2 (32-bit) too and it gave the same (incorrect) output.i don't know, perhaps i am doing something wrong...
Girish
+2  A: 

I see you've mostly figured this out, but I thought I'd add the "why" of it. The Terminal font is based on code page 437, aka DOS-US. á is in position 160.

There aren't many fonts for code page 437. I think Terminal is the only TrueType one, in fact! At any rate, if you're not explicitly trying to display old school DOS graphics, you shouldn't be using Terminal.

What's code page 437 all about? It's "high ASCII", circa 1981. In addition to the usual 32-127 characters, it includes a few accented letters, box graphic characters to draw borders around things, some mathematical symbols and even symbols for the four suits of cards! But the world moved a different way, so aside from 32-127, even the glyphs that are usually available in other fonts aren't where you'd expect them to be. If you were running an old text-mode MSDOS program in a window, it would be using a code page 437 font.

See "code page 437" (Wikipedia) for more information.

Steven Fisher
Tewha, thanks for the clarification. It's perfectly clear now.Thanks a lot!
Girish