Fossil SCM
Fix [5a0a33f31a]: Chinese commit message File in code UTF-8 when using commit -M under WINDOWS Garbled. When the file is already detected to be valid UTF-8, don't try to do any conversion.
Commit
5960016a3d8f1f3278a30bc5a505ba273d0f024d
Parent
3f5defebebdeced…
2 files changed
+2
-2
+1
-1
+2
-2
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -1193,12 +1193,12 @@ | ||
| 1193 | 1193 | /* Make sure the blob contains two terminating 0-bytes */ |
| 1194 | 1194 | blob_append(pBlob, "", 1); |
| 1195 | 1195 | zUtf8 = blob_str(pBlob) + bomSize; |
| 1196 | 1196 | zUtf8 = fossil_unicode_to_utf8(zUtf8); |
| 1197 | 1197 | blob_set_dynamic(pBlob, zUtf8); |
| 1198 | -#if defined(_WIN32) | |
| 1199 | - }else if( useMbcs ){ | |
| 1198 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 1199 | + }else if( useMbcs && invalid_utf8(pBlob) ){ | |
| 1200 | 1200 | zUtf8 = fossil_mbcs_to_utf8(blob_str(pBlob)); |
| 1201 | 1201 | blob_reset(pBlob); |
| 1202 | 1202 | blob_append(pBlob, zUtf8, -1); |
| 1203 | 1203 | fossil_mbcs_free(zUtf8); |
| 1204 | 1204 | #endif /* _WIN32 */ |
| 1205 | 1205 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -1193,12 +1193,12 @@ | |
| 1193 | /* Make sure the blob contains two terminating 0-bytes */ |
| 1194 | blob_append(pBlob, "", 1); |
| 1195 | zUtf8 = blob_str(pBlob) + bomSize; |
| 1196 | zUtf8 = fossil_unicode_to_utf8(zUtf8); |
| 1197 | blob_set_dynamic(pBlob, zUtf8); |
| 1198 | #if defined(_WIN32) |
| 1199 | }else if( useMbcs ){ |
| 1200 | zUtf8 = fossil_mbcs_to_utf8(blob_str(pBlob)); |
| 1201 | blob_reset(pBlob); |
| 1202 | blob_append(pBlob, zUtf8, -1); |
| 1203 | fossil_mbcs_free(zUtf8); |
| 1204 | #endif /* _WIN32 */ |
| 1205 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -1193,12 +1193,12 @@ | |
| 1193 | /* Make sure the blob contains two terminating 0-bytes */ |
| 1194 | blob_append(pBlob, "", 1); |
| 1195 | zUtf8 = blob_str(pBlob) + bomSize; |
| 1196 | zUtf8 = fossil_unicode_to_utf8(zUtf8); |
| 1197 | blob_set_dynamic(pBlob, zUtf8); |
| 1198 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 1199 | }else if( useMbcs && invalid_utf8(pBlob) ){ |
| 1200 | zUtf8 = fossil_mbcs_to_utf8(blob_str(pBlob)); |
| 1201 | blob_reset(pBlob); |
| 1202 | blob_append(pBlob, zUtf8, -1); |
| 1203 | fossil_mbcs_free(zUtf8); |
| 1204 | #endif /* _WIN32 */ |
| 1205 |
+1
-1
| --- src/utf8.c | ||
| +++ src/utf8.c | ||
| @@ -25,11 +25,11 @@ | ||
| 25 | 25 | #ifdef _WIN32 |
| 26 | 26 | # include <windows.h> |
| 27 | 27 | #endif |
| 28 | 28 | #include "cygsup.h" |
| 29 | 29 | |
| 30 | -#ifdef _WIN32 | |
| 30 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 31 | 31 | /* |
| 32 | 32 | ** Translate MBCS to UTF-8. Return a pointer to the translated text. |
| 33 | 33 | ** Call fossil_mbcs_free() to deallocate any memory used to store the |
| 34 | 34 | ** returned pointer when done. |
| 35 | 35 | */ |
| 36 | 36 |
| --- src/utf8.c | |
| +++ src/utf8.c | |
| @@ -25,11 +25,11 @@ | |
| 25 | #ifdef _WIN32 |
| 26 | # include <windows.h> |
| 27 | #endif |
| 28 | #include "cygsup.h" |
| 29 | |
| 30 | #ifdef _WIN32 |
| 31 | /* |
| 32 | ** Translate MBCS to UTF-8. Return a pointer to the translated text. |
| 33 | ** Call fossil_mbcs_free() to deallocate any memory used to store the |
| 34 | ** returned pointer when done. |
| 35 | */ |
| 36 |
| --- src/utf8.c | |
| +++ src/utf8.c | |
| @@ -25,11 +25,11 @@ | |
| 25 | #ifdef _WIN32 |
| 26 | # include <windows.h> |
| 27 | #endif |
| 28 | #include "cygsup.h" |
| 29 | |
| 30 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 31 | /* |
| 32 | ** Translate MBCS to UTF-8. Return a pointer to the translated text. |
| 33 | ** Call fossil_mbcs_free() to deallocate any memory used to store the |
| 34 | ** returned pointer when done. |
| 35 | */ |
| 36 |