Please nominate your Qt Champions for 2021!

Japanese directory separators

  • On Japanese (Windows) systems suffering from an unfortunate bug I only see on Windows that was introduced decades ago, it is unfortunately customary to use ¥ as the symbol for a directory separator.

    Having looked around, it looks like I may have to handle this transformation myself when needed to convert, for example:


    (although maybe not quite like that, but with c:\ in it or something, because I understand this is a Windows ugliness from decades ago that just won't die, and other OSes never got suckered into it)

    I suspect (hope) this will typically be for display purposes.

    Unless anyone knows of a helpful QT function that can do this for me? (By which I don't mean a character replace function - I mean a way to present a QDir or QFile or QFileInfo or some other object, and get back whatever the path to that file/dir would look like on a system using locale XXX)

    Having done a bit of research, this does look like a legacy windows ugliness that hangs around these days for no other reason than people are used to it, which is sickening, but it is what it is.

    I expect there is no QT built-in functionality for this, as that would have involved deliberately coding something to show the user something nonsensical just to fit in with a mistake made by a different company decades ago, but it's nice to check :)

  • Moderators

  • [quote author="sierdzio" date="1410946072"]Use "QDir::toNativeSeparators()":[/quote]

    As far as I can tell from the documentation, that uses forward slash and backslash. it does not suffer from the Yen problem (and thus doesn't do what I want in this case)

  • Moderators

    Try it before passing such judgement ;) I think you are right, but we may be wrong.

  • I've got a funny feeling that the code I have that produces the QString that is the path I need to fiddle with for display purposes already went through it anyway.

Log in to reply