Page 1 of 2

How to lowercase a unicode character?

Posted: Mon Dec 17, 2007 2:05 pm
by mubinaktan
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?

.

Posted: Mon Dec 17, 2007 2:10 pm
by Dare
Hi mubinaktan.

Are you compiling in unicode mode? (Compiler Options)

Can you show a short example prog that gives a general overview of what you are doing?

Not sure I can help but if not, somebody here sure can! :)

Posted: Mon Dec 17, 2007 3:39 pm
by mubinaktan
Oh yes, I am compiling in unicode. It's something like this:

Code: Select all

OpenConsole()
Print("Write anything here: ")
x.s = Input()

PrintN(LCase(x))

While Inkey()="": Wend: CloseConsole(): End
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)

.

Posted: Mon Dec 17, 2007 3:52 pm
by superadnim
True, in unicode it doesn't lower the Ü but its worth mentioning you don't need unicode for those characters.

Posted: Mon Dec 17, 2007 4:06 pm
by Tranquil
mubinaktan wrote: Deutschland ÜBER Alles -> deutschland Über alles (umlauted U is still capital)
Not the best example course its part of the forbidden German anthem. Maybe you know that.

Posted: Mon Dec 17, 2007 7:30 pm
by mubinaktan
superadnim wrote:True, in unicode it doesn't lower the Ü but its worth mentioning you don't need unicode for those characters.
Oh, do I not need unicode? Could you plz gimme a quick example?

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? :? )

Posted: Mon Dec 17, 2007 7:43 pm
by Tranquil
mubinaktan wrote: (Shall I go into the jail? :? )
Of cource yes! And dont take the 4000$. :-)

Posted: Mon Dec 17, 2007 8:05 pm
by thefool
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 :P

Posted: Mon Dec 17, 2007 8:23 pm
by utopiomania
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 

Posted: Mon Dec 17, 2007 10:17 pm
by blueznl
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 :P
Now all it takes is a little spelling lessons, shave your head (or put on a small moustache) and start walking funny...

:P

I thought it's no longer part of the national anthem? Then again, I'm Dutch, what do I know...

Posted: Mon Dec 17, 2007 10:34 pm
by Trond
It's neither forbidden nor current nor "ünicode". Debug 'Ü' to see that the Ü is in the normal ascii character set.

Posted: Mon Dec 17, 2007 10:46 pm
by mubinaktan
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... :lol:

.

Posted: Mon Dec 17, 2007 10:55 pm
by utopiomania
charUpper_()/charLower_() procedures are part of the Windows API, and you can access them directly from
PureBasic by adding an underscore to the API function names.

Check out sample codes posted on the forums, and you will see them used from time to time.

Posted: Mon Dec 17, 2007 11:38 pm
by milan1612
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... :lol:.
I don't think you know what it means, do ya?
Translated to english, the forbidden strophe means:
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.
It's pretty obvious why it is forbidden...

Posted: Tue Dec 18, 2007 3:26 am
by superadnim
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... :lol:

.
Don't forget about "Viva perón"

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.