Bug 153051 - Wrong characters in user and group names in file tips then using UTF8 non english locale
Summary: Wrong characters in user and group names in file tips then using UTF8 non eng...
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kde
Classification: I don't know
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords: needs_verification
Depends on:
Blocks:
 
Reported: 2007-11-28 13:17 UTC by Aleksei Timofeyev
Modified: 2009-01-21 05:37 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.