Fossil SCM

Commit comments with multi-byte character break

Fixed

13b73889641e1b6… · opened 15 years, 1 month ago

Type
Code_Defect
Priority
Severity
Minor
Resolution
Fixed
Subsystem
Created
Feb. 13, 2011 2:59 p.m.

I use windows command line prompt cmd to commit changes with command "fossil commit -m "修正问题。", and then use command "fossil ui" to view the commitment. And find chaos of comments, only after chosing the web page encoding to GBK and the comments seem OK. I had try following modify and it works fine.

src/checkin.c 
========================================
@@ -740,9 +740,11 @@
   blob_appendf(pOut, "Z %b\n", &mcksum;);
   if( pnFBcard ) *pnFBcard = nFBcard;
 }

-
+#if defined(_WIN32)
+extern char *sqlite3_win32_mbcs_to_utf8(const char*);
+#endif
 /*
 ** COMMAND: ci
 ** COMMAND: commit
 **
@@ -970,8 +972,16 @@
     if( blob_str(&ans;)[0]!='y' ){
       fossil_exit(1);
     }
   }else{
+#if defined(_WIN32)
+    char *zConvertComment = sqlite3_win32_mbcs_to_utf8(blob_str(&comment;));
+    if (zConvertComment){
+      blob_reset(&comment;);
+      blob_append(&comment;, zConvertComment, -1);
+      free(zConvertComment);
+    }
+#endif
     db_multi_exec("REPLACE INTO vvar VALUES('ci-comment',%B)", &comment;);
     db_end_transaction(0);
     db_begin_transaction();
   }

jan.nijtmans added on 2012-10-22 08:00:09 UTC: should be fixed in version 1.24


Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button