How to lowercase a unicode character?

Just starting out? Need help? Post your questions and find answers here.
mubinaktan
User
User
Posts: 19
Joined: Mon Oct 08, 2007 11:25 am

How to lowercase a unicode character?

Post 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?

.
Dare
Addict
Addict
Posts: 1965
Joined: Mon May 29, 2006 1:01 am
Location: Outback

Post 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! :)
Dare2 cut down to size
mubinaktan
User
User
Posts: 19
Joined: Mon Oct 08, 2007 11:25 am

Post 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)

.
superadnim
Enthusiast
Enthusiast
Posts: 480
Joined: Thu Jul 27, 2006 4:06 am

Post by superadnim »

True, in unicode it doesn't lower the Ü but its worth mentioning you don't need unicode for those characters.
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post 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.
Tranquil
mubinaktan
User
User
Posts: 19
Joined: Mon Oct 08, 2007 11:25 am

Post 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? :? )
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post by Tranquil »

mubinaktan wrote: (Shall I go into the jail? :? )
Of cource yes! And dont take the 4000$. :-)
Tranquil
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post 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
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post 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 
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post 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...
( 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... )
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

It's neither forbidden nor current nor "ünicode". Debug 'Ü' to see that the Ü is in the normal ascii character set.
mubinaktan
User
User
Posts: 19
Joined: Mon Oct 08, 2007 11:25 am

Post 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:

.
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Post 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.
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post 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...
Windows 7 & PureBasic 4.4
superadnim
Enthusiast
Enthusiast
Posts: 480
Joined: Thu Jul 27, 2006 4:06 am

Post 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.
Post Reply