William Leara
William Leara

Reputation: 10697

Can TortoiseSVN Create Unicode Patches?

I'm trying to use the TortoiseSVN Create Patch/Apply Patch feature. It doesn't seem to work correctly with Unicode files, which is the format for many of our source code files. It looks like they're being treated as binary files--the message I get is:

Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Specifically, the format of these files is UTF-16 Big Endian.

Is it possible to create Unicode patches with TortoiseSVN Create Patch/Apply Patch?

Upvotes: 2

Views: 1347

Answers (1)

Ben Reser
Ben Reser

Reputation: 5765

Subversion is determining that the file is binary since it's not really aware of UTF-16 and it's seeing sequences that it thinks are binary.

Setting the svn:mime-type property to text/plain;encoding=UTF-16BE will make Subversion handle the files as text (the ;encoding=UTF-16BE bit is optional but if you host with Apache httpd it'll make them show up properly in a web browser). That should avoid errors about the binary types.

Creating diffs should then work, but I wouldn't guarantee it because we don't officially support UTF-16 and it's not tested.

Using the command line clients svn patch command doesn't work for me with patches created this way. I'm not sure if Tortoise is using the patch infrastructure from the Subversion project's libraries (like the command-line client is) or if it's using their own from TortoiseMerge. From what I understand TortoiseMerge is UTF-16 aware.

This really is something we should resolve. It comes up from time to time. We have a long standing open issue on this.

Upvotes: 1

Related Questions