[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: property display on file properties dialog missing (moved to separate dialog) in 1.4 (give my properties back)

From: Kazutoshi Satoda <k_satoda_at_f2.dion.ne.jp>
Date: 2006-09-30 13:53:37 CEST

Stefan Küng wrote:
> Tan Ruyan wrote:
>> I notice that properties dialog have some problems when show
>> no-english characters.
>>
>> But in the edit property dialog there is fine.
>>
>> problem is here:
>> =============================
>> http://tortoisesvn.tigris.org/svn/tortoisesvn/trunk/src/TortoiseProc/PropDlg.cpp
>>
>>
>> UINT CPropDlg::PropThread()
>> {
>> SVNProperties props(m_Path, m_rev);
>>
>> m_proplist.SetRedraw(false);
>> int row = 0;
>> for (int i=0; i<props.GetCount(); ++i)
>> {
>> CString name = props.GetItemName(i).c_str();
>> CString val = CUnicodeUtils::GetUnicode((char
>> *)props.GetItemValue(i).c_str());
>>
>> .......
>> ==========================
>
> What's the problem here?

Here, the encoding of val is the native (multibyte) encoding.
GetUnicode() perform conversion from UTF-8 to Unicode. So the conversion
can be wrong. I can reproduce this problem in Japanese environment.

Attached patch will fix this problem. And adds a comment to clarify the
representation of a property value through class SVNProperties.

I wrote this patch 2 days ago, and now I found the best thread to post.
Thanks.

--
k_satoda

Index: src/SVN/SVNProperties.h
===================================================================
--- src/SVN/SVNProperties.h (revision 7591)
+++ src/SVN/SVNProperties.h (working copy)
@@ -32,6 +32,13 @@
  * Subversion Properties.
  * Use this class to retrieve, add and remove Subversion properties
  * for files and directories.
+ *
+ * A property value is represented in std::string. If a property is a
+ * known text property (like svn:* or bugtraq:* or tsvn:*), the value
+ * is converted to(from) UTF-8 from(to) the native encoding in this
+ * class. Otherwise the value is treated as a raw binary data, and no
+ * conversion is performed. This behavior is same as "svn propset" and
+ * "svn propget".
  */
 class SVNProperties
 {
Index: src/TortoiseProc/PropDlg.cpp
===================================================================
--- src/TortoiseProc/PropDlg.cpp (revision 7591)
+++ src/TortoiseProc/PropDlg.cpp (working copy)
@@ -110,7 +110,7 @@
         for (int i=0; i<props.GetCount(); ++i)
         {
                 CString name = props.GetItemName(i).c_str();
- CString val = CUnicodeUtils::GetUnicode((char *)props.GetItemValue(i).c_str());
+ CString val = props.GetItemValue(i).c_str();
 
                 int nFound = -1;
                 do

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Sat Sep 30 13:53:48 2006

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.