News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Macro lcase$

Started by clamicun, March 07, 2019, 12:50:41 AM

Previous topic - Next topic

clamicun

Is it true that lcase$ doesn't work with Ü Ä Ö ?

include \masm32\include\masm32rt.inc

.data
example1 db "ANWEISUNG",0
example2 db "ÜBERWEISUNG",0
example3 db "ÖLTANKER",0
example4 db "ÄCHTUNG",0

.code
start:

INVOKE MessageBox,0,offset example1,offset example1,0
mov eax,lcase$(offset example1)
INVOKE MessageBox,0,offset example1,offset example1,0

INVOKE MessageBox,0,offset example2,offset example2,0
mov eax,lcase$(offset example2)
INVOKE MessageBox,0,offset example2,offset example2,0

INVOKE MessageBox,0,offset example3,offset example3,0
mov eax,lcase$(offset example3)
INVOKE MessageBox,0,offset example3,offset example3,0

INVOKE MessageBox,0,offset example4,offset example4,0
mov eax,lcase$(offset example4)
INVOKE MessageBox,0,offset example4,offset example4,0

INVOKE ExitProcess,0
end start

hutch--

If you are using a single byte character, it uses the algo in the library "szLower" which works with the uppercase alphabetical range of A to Z.

jj2007


clamicun

Jochen,
würde ich ja, aber - wie so oft bei MasmBasic verstehe ich die Syntax nicht.

Let esi=offset example2
Lower$ ??


TimoVJL

If you like win32 API: CharLowerBuff
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#pragma comment(lib, "user32.lib")
#pragma comment(lib, "msvcrt.lib")

void __cdecl mainCRTStartup(void)
{
char soem[30], s[] = "GRÜEßEN ÖLTANKER ÄCHTUNG";
CharLowerBuffA(s, sizeof(s));
CharToOemBuff(s, soem, sizeof(s));
puts(soem);
MessageBox(0,s,0,0);
exit(0);
}
May the source be with you

aw27

GRÜEßEN ÖLTANKER ÄCHTUNG - > grüeßen öltanker ächtung

I attach C code but is easy to convert to ASM in 5 minutes.

jj2007

Quote from: clamicun on March 07, 2019, 09:09:10 AM
Jochen,
würde ich ja, aber - wie so oft bei MasmBasic verstehe ich die Syntax nicht.

Let esi=offset example2
Lower$ ??

include \masm32\MasmBasic\MasmBasic.inc ; download
.data
example db "ÄÖÜ", 0

  SetGlobals my$="German umlauts: ÄÖÜß - and some more: ÉÊÈÆÌÍÎÏÒÓÔÕÖØÙÚÛÜÁÂÀÃÅÞÍÎÌÏÑÓÔÒÕÚÛÙ - ДОБРО ПОЖАЛОВАТЬ"
  Init
  PrintLine Lower$(offset example)
  PrintLine my$
  Let esi=Lower$(my$)
  PrintLine esi
  PrintLine Lower$(my$)
  Inkey Upper$(esi)
EndOfCode


Output:
C:\>mb
äöü
German umlauts: ÄÖÜß - and some more: ÉÊÈÆÌÍÎÏÒÓÔÕÖØÙÚÛÜÁÂÀÃÅÞÍÎÌÏÑÓÔÒÕÚÛÙ - ДОБРО ПОЖАЛОВАТЬ
german umlauts: äöüß - and some more: éêèæìíîïòóôõöøùúûüáâàãåþíîìïñóôòõúûù - добро пожаловать
german umlauts: äöüß - and some more: éêèæìíîïòóôõöøùúûüáâàãåþíîìïñóôòõúûù - добро пожаловать
GERMAN UMLAUTS: ÄÖÜß - AND SOME MORE: ÉÊÈÆÌÍÎÏÒÓÔÕÖØÙÚÛÜÁÂÀÃÅÞÍÎÌÏÑÓÔÒÕÚÛÙ - ДОБРО ПОЖАЛОВАТЬ


For comparison:
C:\>aw
grãoeãÿen ã-ltanker ã"chtung

(might be a codepage problem...)

aw27

You, or your hidden library function, changed the code page of the console to ANSI but forgot to tell the people where to download your Russian Characters Font.  :(



Then you went to test my proggy in code page 1252  :badgrin:

aw27

Another challenge:
Ć-Ń-Į-Ŗ-Ś ) Ar Čia kas Ų nors kalba ...? -> ć-ń-į-ŗ-ś ) ar čia kas ų nors kalba ...?  :t

clamicun

Many thanks to everyone who responded !

Problem resolved.

jj2007

Quote from: AW on March 07, 2019, 06:01:29 PMThen you went to test my proggy in code page 1252  :badgrin:

Print sets codepage Utf-8. Interesting that it exits with 1252 on your machine. What does the console reply when you try chcp 65001?

aw27

Quote from: jj2007 on March 07, 2019, 08:07:54 PM
Print sets codepage Utf-8. Interesting that it exits with 1252 on your machine. What does the console reply when you try chcp 65001?
Sorry, I don't see any Print, I just copied and pasted. You need to explain things to me slowly.

My proggy, as it was, will work with the usual OEM codepages - no UTF-8 no Ansi.

jj2007

The interesting bit is that my exe sets the codepage to 65001 (=Utf8). However, it seems that on your machine it fails to do so - your chcp without args returns 1252. When I launch my exe and do a chcp directly after, it will show 65001.

clamicun

Jochen,
ich weiss, Du raufst Dir die Haare über soviel Unverstand.

Dies funktioniert.
example db "ÜBERWEISÜNG",0

mov esi,offset example
PrintLine Lower$(esi)

Die Console gibt "überweisüng" aus.

Aber in esi ist immer noch "ÜBERWEISÜNG"
Aber ich benötige den Text in Kleinbuchstaben für eine weitere Verwendung.

Wie leite ich den Consolentext in eine andere Variable um ?
Lower$(esi) allein gibt den Fehler "Syntaxerror Use_Let"

clamicun

I think I got it

mov edi,offset example
Let esi=Lower$(edi)
INVOKE MessageBox,0,esi,offset example,0

???