How to lowercase a unicode character?
-
- User
- Posts: 19
- Joined: Mon Oct 08, 2007 11:25 am
How to lowercase a unicode character?
I am trying to "LCase" the user input. But it fails when a unicode character is entered. Thye program simply outputs the entered string.
How can I fix this?
.
How can I fix this?
.
-
- User
- Posts: 19
- Joined: Mon Oct 08, 2007 11:25 am
Oh yes, I am compiling in unicode. It's something like this:
After running the program, if I enter a string that contains unicode and standard ASCII characters the program lowercases the ASCII characters but makes nothing to unicode characters.
(I am not sure that people can see the umlauted letters here)
BLaH bLaH blAH -> blah blah blah (it's ok)
Deutschland ÜBER Alles -> deutschland Über alles (umlauted U is still capital)
.
Code: Select all
OpenConsole()
Print("Write anything here: ")
x.s = Input()
PrintN(LCase(x))
While Inkey()="": Wend: CloseConsole(): End
(I am not sure that people can see the umlauted letters here)
BLaH bLaH blAH -> blah blah blah (it's ok)
Deutschland ÜBER Alles -> deutschland Über alles (umlauted U is still capital)
.
-
- Enthusiast
- Posts: 480
- Joined: Thu Jul 27, 2006 4:06 am
-
- User
- Posts: 19
- Joined: Mon Oct 08, 2007 11:25 am
Oh, do I not need unicode? Could you plz gimme a quick example?superadnim wrote:True, in unicode it doesn't lower the Ü but its worth mentioning you don't need unicode for those characters.
BTW, I thought that "Deutschland, Deutschland, über alles auf der Welt" was the *current* German anthem. I didn't know that it was "forbidden".
(Shall I go into the jail?

- utopiomania
- Addict
- Posts: 1655
- Joined: Tue May 10, 2005 10:00 pm
- Location: Norway
This works here if compiled to unicode:
Code: Select all
openConsole()
s.s = "Deutschland ÜBER Alles"
charLower_(@s)
printN(s)
s.s = "Deutschland ÜBER Alles"
charUpper_(@s)
printN(s)
while inkey() = ""
wend
closeConsole()
end
Now all it takes is a little spelling lessons, shave your head (or put on a small moustache) and start walking funny...thefool wrote:Luckily, again, I am from denmark. And I can write deutchland über alles where i want to, even sing it without anything happening. Of course if I do grafitti in germany then maybe

I thought it's no longer part of the national anthem? Then again, I'm Dutch, what do I know...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
-
- User
- Posts: 19
- Joined: Mon Oct 08, 2007 11:25 am
utopiomania wrote:This works here if compiled to unicode:
Code: Select all
openConsole() s.s = "Deutschland ÜBER Alles" charLower_(@s) printN(s) s.s = "Deutschland ÜBER Alles" charUpper_(@s) printN(s) while inkey() = "" wend closeConsole() end
Oh, yeah, that worked! But a little explanation would be nice. What the hell "CharUpper_" and "CharLower_"? If they are built-in functions why don't the autocompletion recognize them?
P.S.: Is it forbidden to say "Deutschland über alles" in Germany? That's interesting... So it should be forbidden to say "God save the Queen" in United Kingdom, "Viva Espana" in Spain or "Gooooaaaaal !!!" in Brazil...

.
- utopiomania
- Addict
- Posts: 1655
- Joined: Tue May 10, 2005 10:00 pm
- Location: Norway
I don't think you know what it means, do ya?mubinaktan wrote:P.S.: Is it forbidden to say "Deutschland über alles" in Germany? That's interesting...
So it should be forbidden to say "God save the Queen" in United Kingdom, "Viva Espana" in Spain or "Gooooaaaaal !!!" in Brazil....
Translated to english, the forbidden strophe means:
It's pretty obvious why it is forbidden...Germany, Germany above all,
Above everything in the world,
When always, for protection,
We stand together as brothers.
From the Maas to the Memel
From the Etsch to the Belt -
Germany, Germany above all
Above all in the world.
Windows 7 & PureBasic 4.4
-
- Enthusiast
- Posts: 480
- Joined: Thu Jul 27, 2006 4:06 am
Don't forget about "Viva perón"mubinaktan wrote:utopiomania wrote:This works here if compiled to unicode:
Code: Select all
openConsole() s.s = "Deutschland ÜBER Alles" charLower_(@s) printN(s) s.s = "Deutschland ÜBER Alles" charUpper_(@s) printN(s) while inkey() = "" wend closeConsole() end
Oh, yeah, that worked! But a little explanation would be nice. What the hell "CharUpper_" and "CharLower_"? If they are built-in functions why don't the autocompletion recognize them?
P.S.: Is it forbidden to say "Deutschland über alles" in Germany? That's interesting... So it should be forbidden to say "God save the Queen" in United Kingdom, "Viva Espana" in Spain or "Gooooaaaaal !!!" in Brazil...
.
As I mentioned, you don't need Unicode for that particular example, and Trond also affirmed it, because it's an ascii character. debug from 0 to 255 and you'll see all the characters ascii supports.
The Win-API calls are OK, as long as you don't plan to port your code into Linux / MacOS.