Steve Lacey. Get yours at flagrantdisregard.com/flickr

An OSX Unicode Challenge

| | Comments (2) | TrackBacks (0)

Say you have a unicode string that contains a full path filename.

Now, open that file.

That’s it. That’s the challenge. The filename must not be converted into a non-unicode form and you must use the Carbon APIs. No dipping into Posix and non-unicode land.

Bonus points for the fewest API calls and shortest code.

Of course on Windows it’s just one call -

CreateFileW()

, but for the life of me I can’t figure out how to do it succinctly on OSX.


0 TrackBacks

Listed below are links to blogs that reference this entry: An OSX Unicode Challenge.

TrackBack URL for this entry: http://www.steve-lacey.com/cgi-bin/mt/mt-bar.cgi/812

2 Comments

Jay Allen said:

:-|

I've never had much hand at Mac hacking. Been doing Un*x and Windows for over a decade. This post really makes me appreciate that.

Sandy said:

You didn't say how your unicode string was encoded, so I'll suppose utf8. Here's the code:

FILE *f = fopen( path, "w" );

:-)

Leave a comment

About Me

Steve Lacey, software developer at Facebook, British, married to the lurvely Nabila, dad to the wonderful Julian and Jasmine. Living in Kirkland (near Seattle), WA.


A brief professional bio.


steve@steve-lacey.com
+1 (425) 214-4716

About this Entry

This page contains a single entry by Steve published on May 23, 2006 10:10 PM.

Unicode On OSX was the previous entry in this blog.

A Family Through Time is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Statsorama

  • 1050 posts
  • 1333 comments

Music