On Fri, Oct 21, 2011 at 11:15:19AM +0200, TomÃ¡Å¡ Bihary wrote:
> after upgrading the svn 1.7 I realized an issue.
> When I add an empty UTF-8 file, it is added with mimetype
> The empty UTF8 file has 3 bytes size - there are just the 3 mark
> bytes 0xEF 0xBB 0xBF
The same happened in svn 1.6 though, didn't it?
We could special-case the UTF-8 BOM in the mime-type detection logic.
See the patch below. Can you try this patch?
Note that the UTF-8 BOM is, as far as I know, only used by Windows.
So this problem should only happen there.
> If there is an content in that file, it is handled correctly like text.
> I've found a similar issue 2194 with UTF-16 files which status is REOPENED.
UTF-16 files are always marked binary at the moment.
This is because the internal diff and merge functionality does not
understand UTF-16. As a workaround, you can configure an external
diff/merge tool that understands UTF-16 files:
--- subversion/libsvn_subr/io.c (revision 1186983)
+++ subversion/libsvn_subr/io.c (working copy)
@@ -2968,6 +2968,13 @@ svn_io_detect_mimetype2(const char **mimetype,
/* Now close the file. No use keeping it open any more. */
+ if (amt_read == 3 && block == 0xEF && block == 0xBB && block == 0xBF)
+ /* This is an empty UTF-8 file which only contains the UTF-8 BOM.
+ * Treat it as plain text. */
+ return SVN_NO_ERROR;
if (svn_io_is_binary_data(block, amt_read))
*mimetype = generic_binary;
Received on 2011-10-21 13:12:16 CEST