Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
G
GLib
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 926
    • Issues 926
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 60
    • Merge Requests 60
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GNOME
  • GLib
  • Issues
  • #1937

Closed
Open
Opened Nov 10, 2019 by Tony Houghton@realh69

g_get_charset() thinks UTF-8 system is ASCII

I noticed g_print was replacing non-ASCII but valid UTF-8 characters with question marks, while printf displayed them correctly, so I wrote a quick test. When I compile and run the code below on Arch Linux it prints:

Charset is 'ANSI_X3.4-1968' (not UTF)

My LANG environment variable is set to en_GB.UTF-8, consistent with /etc/locale, which is the standard way to configure the charset on a Linux desktop AFAIK, so shouldn't glib read it from that?

#include <glib.h>

int main()
{
    const char *charset = NULL;
    gboolean utf = g_get_charset(&charset);
    g_print("Charset is '%s' (%sUTF)\n", charset, utf ? "" : "not ");
    return 0;
}
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: GNOME/glib#1937