Bug 153051

Summary: Wrong characters in user and group names in file tips then using UTF8 non english locale
Product: [I don't know] kde Reporter: Aleksei Timofeyev <aleksei.timofeyev>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: finex, mboquien
Priority: NOR Keywords: needs_verification
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Aleksei Timofeyev 2007-11-28 13:17:25 UTC
Version:            (using KDE KDE 3.5.7)
Installed from:    SuSE RPMs
OS:                Linux

Im using Russian UTF8 locale and have user names and group names in Russian. Then i point mouse over files owned by this  users or groups i have non readable names. I try to find there is problem. In KDE/3.5/kdelibs/kio/kio/kfileitem.cpp:

QString KFileItem::user() const
{
  if ( m_user.isEmpty() && m_bIsLocalURL )
  {
    KDE_struct_stat buff;
    if ( KDE_lstat( QFile::encodeName(m_url.path( -1 )), &buff ) == 0) // get uid/gid of the link, if it's a link
    {
      struct passwd *user = getpwuid( buff.st_uid );
      if ( user != 0L )
        m_user = QString::fromLocal8Bit(user->pw_name);
    }
  }
  return m_user;
}

m_user = QString::fromLocal8Bit(user->pw_name);

if user->pw_name in UTF8 we have wrong translation.
i think we have to use QTextCodec to get right translation.


QString KFileItem::group() const
{
#ifdef Q_OS_UNIX
  if (m_group.isEmpty() && m_bIsLocalURL )
  {
    KDE_struct_stat buff;
    if ( KDE_lstat( QFile::encodeName(m_url.path( -1 )), &buff ) == 0) // get uid/gid of the link, if it's a link
    {
      struct group *ge = getgrgid( buff.st_gid );
      if ( ge != 0L ) {
        m_group = QString::fromLocal8Bit(ge->gr_name);
        if (m_group.isEmpty())
          m_group.sprintf("%d",ge->gr_gid);
      } else
        m_group.sprintf("%d",buff.st_gid);
    }
  }
#endif
  return m_group;
}


m_group = QString::fromLocal8Bit(ge->gr_name);

Same as for user() function.
Comment 1 Médéric Boquien 2008-11-08 22:31:52 UTC
Hello,

Can you try with the latest KDE 4 version to see if the problem is still present?

Thanks.