Results 1 to 1 of 1

Thread: SOLVED utf-8, passthru and °

  1. #1
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    16
    Thanked 2 Times in 1 Post

    Default SOLVED utf-8, passthru and °

    Hello,
    I am writing a little console program that will spit out a bit of html to be used by php's passthru() function:
    Qt Code:
    1. <?php passthru('/var/www/bin/myprog');?>
    To copy to clipboard, switch view to plain text mode 
    Now I need to display the character °, but the output I get with QString in the resulting html is °.
    So I'm trying to get rid of the  but no succes till now.

    I'm thinking that it's because of the unicode in QString but f I try with char in stead of QString it won't even output anything, ie:

    Qt Code:
    1. char *s = "°"; // or 167
    2. cout << s;
    To copy to clipboard, switch view to plain text mode 
    just prints nothing.

    When I launch the program from bash, it displays the ° ok, but if I copy that character from the console to an editor I get an ° again, meaning it's still unicode.

    I tried various things, .toUtf8(), etc etc but I can't get the right character to display.

    How can I get the ° without the  in my html?

    Thanks.

    Edit: solved by adding 'AddDefaultCharset UTF-8' to '/etc/apache2/sites-available/default'. Though I am still curious why there is no output at all on that first code snippet.
    Last edited by JeanC; 18th February 2011 at 13:33.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.