Fixing svn UTF-8 data issues in hgsubversion pull
I've encountered an error while pulling svn changes into my mercurial repo:
abort: ('Valid UTF-8 data\n(hex: 75 6c 6c 20 74 61 73 6b 20 6开发者_JAVA技巧c 69 73 74 20 74 68 65 20 63 6c 69 65 6e 74)\nfollowed by invalid UTF-8 sequence\n(hex: 92 73 20 4e)', 22)
I've found out how to detect it for svn (with a fix for filenames, but not content); how do I apply this detection to hgsubversion so I can continue pulling??
The following does not work - see step 4 (upvote if this is helpful in saving you time :)). Hopefully the real answer is some variation on this...
- Have a look at the svn log for the revision, and see what files are affected (hopefully a small amount)
- for each file use
isutf8 .hg/store/data/trunk/{svn path}
(frommoreutils
package) (where [my] branches appear in the trunk as well due to hg branching stuff I don't understand...). If things are going "correctly wrong", then the offset thatisutf8
complains about should be very close to theinvalid UTF-8 sequence
message. In my case,isutf8
complained at position 24, where my error was at 22 (I reckon this is just reporting either the start or the end of unicode decoding...) Do something along the lines of
iconv -f iso-8859-1 -t utf8 {file name} > {temp file} mv {file name} ~ # For backup purposes mv {temp file} {file name}
Watch as
hg pull
fails again after finally logging svn and starting pulling after I've written my optimistic answer.
精彩评论