4

In my application I have used a backslash as part of a text-based activity indicator (a typical /-\ sequence.. I removed the | because it had a different width). All was well until I saw my application being run on a japanese computer. The backslash was replaced with a japanese character.

How can I avoid this?

boileau
  • 817
  • 6
  • 20
  • 6
    No idea who thought that replacing ASCII characters like `\\` with localized characters was a good idea... – CodesInChaos Feb 01 '12 at 22:38
  • 1
    http://en.wikipedia.org/wiki/Backslash Read and weep – Warren P Feb 02 '12 at 00:30
  • 1
    Cool alternatives: http://stackoverflow.com/questions/2685435/cooler-ascii-spinners/2685827#2685827 – Warren P Feb 02 '12 at 20:19
  • A lot of good suggestions for ascii sequences, but none were quite appropriate for application. It had to be as small as possible, and not have a varying width (Windows' fixed width fonts aren't very nice looking). As I wrote in a comment below, I ended up replacing the ascii sequence with an animation. I selected the only answer that actually answered my question. – boileau Feb 03 '12 at 12:12
  • 1
    And a newly ratified Unicode 6.1 alternative: http://www.fileformat.info/info/unicode/char/1f4a9/index.htm – Warren P Feb 03 '12 at 14:37
  • You may see that it's pretty the same on a Korean computer – phuclv Sep 03 '13 at 06:31

6 Answers6

2

You can use .oOo as a sequence. period, small o, capital O, small o.

that should work under any language.

Gregor Brandt
  • 7,659
  • 38
  • 59
1

In your delphi application you can select a Font that renders that Unicode codepoint as a backslash. However, most standard fonts including many in Windows, will intentionally show a Yen mark instead of a backslash, in Japanese locales, for reason that users expect it.

If you want to be really sure of what is shown, use your own font, one that is not shipped with windows, and install it with your application.

Warren P
  • 65,725
  • 40
  • 181
  • 316
  • I'm accepting this solution because it answers the question I actually asked, and because it seems like it would be the least complicated way to guarantee that my customer sees what I see. I ended up replacing my ascii animation with a sequence of images as suggestted here: http://stackoverflow.com/a/9104518/759899 since it seemed just as easy. – boileau Feb 03 '12 at 12:09
0

You just have to live with this. Editing things like shell scripts on a Japanese computer just looks weird, but you get used to it. Especially if your app is running remotely through an SSH session or something, you cannot possibly have control over what fonts are going to be used to render it.

Your best bet is probably to use fancier characters, like ╱─╲ or something like that and hope the user has a font that can show it.

Celada
  • 21,627
  • 4
  • 64
  • 78
0

Short of migrating to Unicode with a newer version of Delphi, you'll have to find a set of low ASCII characters that can do a suitable animation.
I'd suggest using a digit sequence [0-9] or [1-3] to stay with your 3 chars sequence. That should work with all the Japanese code sets.

Francesca
  • 21,452
  • 4
  • 49
  • 90
0

If the Unicode Fonts on the user computer supports it you could also try charactores of one of these Unicode blocks:

http://en.wikipedia.org/wiki/Arrow_%28symbol%29

http://en.wikipedia.org/wiki/Box_drawing_characters

http://en.wikipedia.org/wiki/Unicode_Geometric_Shapes

http://en.wikipedia.org/wiki/Miscellaneous_Technical_%28Unicode%29

http://en.wikipedia.org/wiki/Miscellaneous_Symbols

(for VCL only, for console applications the problem is the character set / code page of the shell)

But this sounds promising (except for the font part, which could be out of control):

Writeln in Delphi 2009 still uses ANSI (see System TTextRec) but you can use UTF8Encode and change the console's output code page to UTF8 by calling SetConsoleOutputCP(CP_UTF8). You will also need a good font to actually display Unicode characters.

(From https://stackoverflow.com/a/268202/80901)

Community
  • 1
  • 1
mjn
  • 36,362
  • 28
  • 176
  • 378
-2

Hold Ctrl + ` and it should change.

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83