Re: Corruption when merging UTF-16 LE files

Andreas Stieger <[email protected]> Tue, 6 May 2025 12:00:31 +0200
Newsgroups gmane.comp.version-control.subversion.user
Message-ID <[email protected]>
Hello Christopher,

On 2025-05-05 21:12, Christopher Guinnup wrote:
>
> When attempting to merge UTF-16 LE files that have merge conflicts, 
> SVN inserts junk characters, which I suspect are merge conflict 
> notations in the wrong encoding.
>
Last time I checked subversion did not support by default textual 
merging of UTF-16 LE encoded files: 
https://issues.apache.org/jira/browse/SVN-2194  You should mark such 
files binary to disallow textual interpretation. You can use the 
svn:mime-type property and autoprops for new files. There is a 
misconfiguration in your deployment in that aspect.

https://subversion.apache.org/faq.html#binary-files
https://svnbook.red-bean.com/nightly/en/svn.advanced.props.file-portability.html#svn.advanced.props.special.mime-type
https://svnbook.red-bean.com/nightly/en/svn.advanced.props.html#svn.advanced.props.auto

You should deploy a pre-commit hook to prevent subtly corrupted files 
from being committed, or UTF-16 LE from being committed without a binary 
type, or force mergable UTF-8 entirely:

https://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.hooks

You could opt to convert your content to UTF-8, either in the versioned 
data or temporarily for merging/diffing. You could employ a third party 
merge tool that is capable of merging our data. Meld is known to handle 
this correctly.

https://svnbook.red-bean.com/nightly/en/svn.advanced.externaldifftools.html

Andreas