|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2006-02-17 15:42:33
"Peter Dimov" <pdimov_at_[hidden]> wrote in message
news:00af01c6334a$b9ed2200$6407a8c0_at_pdimov2...
> Recently, I needed to fix a program to work properly with paths that
> cannot
> be represented by narrow strings under Windows. The problematic filenames
> came from the user via drag and drop. I tried to go the wstring route, the
> same approach that the filesystem library takes; but it was harder than I
> thought. Many parts of the code base assumed narrow paths.
>
> At the end I reverted the changes and just encoded the wide path into
> UTF-8
> at the very start, passed the UTF-8 string through the existing code, then
> decoded the UTF-8 into a wstring at the very end, immediately before
> calling
> the Windows API. It worked.
Seems like a reasonable and practical approach. I've wondered several times
if we wouldn't have been better off if Microsoft had chosen UTF-8 as their
Window external representation, too.
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk