git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Use FIX_UTF8_MAC to enable conversion from UTF8-MAC to UTF8

From
Dmitry Potapov <dpotapov@gmail.com>
Date
Jan 22, 2008, 11:57 UTC
Message-ID
<20080122115741.GI14871@dpotapov.dyndns.org>
In-Reply-To
<alpine.LFD.1.00.0801212025050.2957@woody.linux-foundation.org>
On Mon, Jan 21, 2008 at 08:59:56PM -0800, Linus Torvalds wrote:
Show 7 quoted lines
> 
> Anyway, even if you do that, our "reencode_string()" is really *so* 
> expensive that you really don't want to do it on a filename by filename 
> basis. It literally does a malloc() for each allocation. It might well be 
> worth it to find something that is more utf-8-specific (and I could well 
> imagine that Mac OS X comes with some UTF libraries, if only because we 
> cannot possibly be the only people with this issue).

Yes, starting with Mac OS X 10.2 there are functions for that. http://developer.apple.com/qa/qa2001/qa1235.html

Anyway, even if iconv is to be used, I believe it should be possible to avoid malloc here (I usually allocate 256 on stack and use malloc()/free() only when I need more than that which in practice never happens!). It is also avoidable to call iconv_open/iconv_close for each name by putting the allocated descriptor for character set conversion into a static variable. Thus leaving iconv() alone, which should not be big overhead provided that it is done only for non-ASCII names.

Dmitry
Previous: Dmitry PotapovNext: Nicolas Pitre
Message 15 of 22 in “Use FIX_UTF8_MAC to enable conversion from UTF8-MAC to UTF8”
  1. Use FIX_UTF8_MAC to enable conversion from UTF8-MAC to UTF8Mark Junker, Jan 21, 2008
  2. Mark JunkerJan 21, 2008
  3. Mark JunkerJan 21, 2008
  4. Mark JunkerJan 21, 2008
  5. Junio C HamanoJan 21, 2008
  6. Mark JunkerJan 21, 2008
  7. Junio C HamanoJan 21, 2008
  8. Mark JunkerJan 21, 2008
  9. H. Peter AnvinJan 22, 2008
  10. Linus TorvaldsJan 22, 2008
  11. Linus TorvaldsJan 22, 2008
  12. Junio C HamanoJan 22, 2008
  13. Robin RosenbergJan 22, 2008
  14. Dmitry PotapovJan 22, 2008
  15. Dmitry PotapovJan 22, 2008
  16. Nicolas PitreJan 22, 2008
  17. Linus TorvaldsJan 22, 2008
  18. Johannes SchindelinJan 21, 2008
  19. Junio C HamanoJan 21, 2008
  20. Mark JunkerJan 21, 2008
  21. Johannes SchindelinJan 21, 2008
  22. Johannes SchindelinJan 21, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.