| Ticket UUID: | d17d6e5b174bd6f8bbe8be6f851de3d721190af8 | ||
| Title: | Handle file names containing brackets, interrogation mark or asterisk | ||
| Status: | Fixed | Type: | Code_Defect |
| Severity: | Minor | Priority: | |
| Subsystem: | Resolution: | Fixed | |
| Last Modified: | 2012-11-30 16:36:27 | ||
| Version Found In: | 7b7fe27678 | ||
| Description & Comments: | |||
|
I am trying to version some Microsoft OpenXML files (docx, xlsx, pptx) that are zipped archives.
A file in the archive is typically named [Content-Types].xml with those brackets. Fossil refuses to handle this file. I think this is because there are GLOB operations in the source code having looked it up quickly. But I am pretty sure it is possible with SQLite to GLOB 'a\?b' ESCAPE '\' Thank you for understanding this issue. anonymous claiming to be benoit added on 2010-06-25 05:26:32: jan.nijtmans added on 2012-11-20 13:47:51 UTC: Feedback welcome. anonymous added on 2012-11-20 15:18:47 UTC:
char *fossil_unicode_to_utf8(void *zUnicode){
#ifdef _WIN32
int nByte = 0;
char *zUtf;
WCHAR *wUnicode = zUnicode;
/*
This my have problem when zUnicode is readonly.
And it's will modify zUnicode when sometimes we did not want to modify it.
*/
while( *wUnicode != 0 ){
if ( (*wUnicode > 0xF000) && (*wUnicode <= 0xF07F) ){
*wUnicode &= 0x7F;
}
++wUnicode;
}
nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0);
zUtf = sqlite3_malloc( nByte );
if( zUtf==0 ){
return 0;
}
WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, zUtf, nByte, 0, 0);
return zUtf;
#else
return (char *)zUnicode; /* No-op on unix */
#endif
}
void *fossil_utf8_to_unicode(const char *zUtf8){
#ifdef _WIN32
/* nWord should be meaningful than nByte here*/
int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
wchar_t *zUnicode = sqlite3_malloc( nByte * 2 );
wchar_t *wUnicode;
if( zUnicode==0 ){
return 0;
}
MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nByte);
wUnicode = zUnicode;
while( --nByte > 0){
if ( (*wUnicode < 32) || wcschr(L"\"*<>?|", *wUnicode) ){
*wUnicode |= 0xF000;
}
++wUnicode;
}
anonymous added on 2012-11-20 15:23:31 UTC:
char *fossil_unicode_to_utf8(void *zUnicode){
#ifdef _WIN32
int nByte = 0;
char *zUtf;
WCHAR *wUnicode = zUnicode;
/*
This my have problem when zUnicode is readonly.
And it's will modify zUnicode when sometimes we did not want to modify it.
*/
while( *wUnicode != 0 ){
if ( (*wUnicode > 0xF000) && (*wUnicode <= 0xF07F) ){
*wUnicode &= 0x7F;
}
++wUnicode;
}
nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0);
zUtf = sqlite3_malloc( nByte );
if( zUtf==0 ){
return 0;
}
WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, zUtf, nByte, 0, 0);
return zUtf;
#else
return (char *)zUnicode; /* No-op on unix */
#endif
}
void *fossil_utf8_to_unicode(const char *zUtf8){
#ifdef _WIN32
/* nWord should be meaningful than nByte here*/
int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
wchar_t *zUnicode = sqlite3_malloc( nByte * 2 );
wchar_t *wUnicode;
if( zUnicode==0 ){
return 0;
}
MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nByte);
wUnicode = zUnicode;
while( --nByte > 0){
if ( (*wUnicode < 32) || wcschr(L"\"*<>?|", *wUnicode) ){
*wUnicode |= 0xF000;
}
++wUnicode;
}
| |||