Fossil

View Ticket
Login

View Ticket

2012-11-30
16:36 Fixed ticket [d17d6e5b17]: Handle file names containing brackets, interrogation mark or asterisk plus 1 other change ... (artifact: 503c86fa78 user: drh)
15:52
Allow characters *[]? to appear in filenames. Tickets [46bf4baedce] and [d17d6e5b174bd6] and [10aee063c413c107] ... (check-in: 647bb7b79f user: drh tags: trunk)
2012-11-20
15:23 Ticket [d17d6e5b17] Handle file names containing brackets, interrogation mark or asterisk status still Open with 1 other change ... (artifact: 7ec2f0ae2d user: anonymous)
15:22 Ticket [d17d6e5b17]: 1 change ... (artifact: 0acc624f7e user: jan.nijtmans)
15:22 Ticket [d17d6e5b17]: 1 change ... (artifact: 07704ccf5a user: anonymous)
15:18 Ticket [d17d6e5b17]: 1 change ... (artifact: 8a0d7c7270 user: anonymous)
13:47 Ticket [d17d6e5b17]: 1 change ... (artifact: 7162bc8b28 user: jan.nijtmans)
13:46
Experimental fix for issue [d17d6e5b17]. <p>Should have a LOT more testing before merging it to trunk, because it is dangerous! <p>The method used is as described at: <br> [http://cygwin.com/cygwin-ug-net/using-specialnames.html] The only problematic characters left are ':' and '\', all other problematic characters are handled by translating them to characters in the range U+F000 to U+F0FF <p>Feedback welcome. ... (check-in: 82ce90f91c user: jan.nijtmans tags: ticket-d17d6e5b17)
2010-06-25
06:19 Ticket [d17d6e5b17] Handle file names containing brackets, interrogation mark or asterisk status still Open with 1 other change ... (artifact: 387e493cbe user: eric)
05:26 Ticket [d17d6e5b17]: 2 changes ... (artifact: c9bbd1fed8 user: anonymous)
05:24 New ticket [d17d6e5b17]. ... (artifact: 0b52db6049 user: benoit)

Ticket Hash: 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:
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:
the hyperlink in the ticket description is actually text surrounded with brackets…


jan.nijtmans added on 2012-11-20 13:47:51 UTC:
Highly experimental fix for this committed in [82ce90f91c]. Should get a lot more testing before going into trunk

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;
  }

return zUnicode; #else return (void *)zUtf8; /* No-op on unix */ #endif }

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;
  }

return zUnicode; #else return (void *)zUtf8; /* No-op on unix */ #endif }