Page 1 of 1 1
Topic Options
#124636 - 2004-08-09 06:53 AM Replace German Umlaute
Rainer_Piechura Offline
Fresh Scripter

Registered: 2004-08-09
Posts: 5
Loc: Bremerhaven, Germany
Hi there,
using Kix Ver.4.22 on Windows XP I'm having problems to
get German Umlaute replaced. I'm using the following Code:
[code]
SELECT
CASE INSTR($NAME,"ä")
$NAME = replace($NAME, "ä", "ae")
CASE INSTR($NAME,"ö")
$NAME = replace($NAME, "ö", "oe")
CASE INSTR($NAME,"ü")
$NAME = replace($NAME, "ü", "ue")
CASE INSTR($NAME,"Ä")
$NAME = replace($NAME, "Ä", "Ae")
CASE INSTR($NAME,"Ö")
$NAME = replace($NAME, "Ö", "Oe")
CASE INSTR($NAME,"Ü")
$NAME = replace($NAME, "Ü", "Ue")
CASE INSTR($NAME,"ß")
$NAME = replace($NAME, "ß", "ss")
CASE INSTR($NAME," ")
$NAME = replace($NAME, " ", "_")
ENDSELECT

? $NAME

Function Replace($String,$SS,$RS)
$Replace=Join(Split($String,$SS),$RS)
EndFunction
[/code]
If I now translate "Wäsche" it replaces correctly, however having for example "Wäsche Änderung" I get back "Waesche aenderung"
Any ideas ?

Thanks, Rainer

Top
#124637 - 2004-08-09 08:27 AM Re: Replace German Umlaute
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
[edit: somehow missed the topic ]

Ok, you need to tell your script to be Case Sensitive
Furthermore you will need the Loop in case of mixed Cases:

Code:

$_ = SETOPTION("CaseSensitivity","ON")

while INSTR($NAME,"ä") or INSTR($NAME,"ö") or INSTR($NAME,"ü")
or INSTR($NAME,"Ä") or INSTR($NAME,"Ö") or INSTR($NAME,"Ü")
or INSTR($NAME,"ß") or INSTR($NAME," ")
SELECT
CASE INSTR($NAME,"ä")
$NAME = replace($NAME, "ä", "ae")
CASE INSTR($NAME,"ö")
$NAME = replace($NAME, "ö", "oe")
CASE INSTR($NAME,"ü")
$NAME = replace($NAME, "ü", "ue")
CASE INSTR($NAME,"Ä")
$NAME = replace($NAME, "Ä", "Ae")
CASE INSTR($NAME,"Ö")
$NAME = replace($NAME, "Ö", "Oe")
CASE INSTR($NAME,"Ü")
$NAME = replace($NAME, "Ü", "Ue")
CASE INSTR($NAME,"ß")
$NAME = replace($NAME, "ß", "ss")
CASE INSTR($NAME," ")
$NAME = replace($NAME, " ", "_")
ENDSELECT
loop

? $NAME



Edited by Jochen (2004-08-09 08:46 AM)
_________________________



Top
#124638 - 2004-08-09 08:47 AM Re: Replace German Umlaute
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
By the way´,

Welcome to the board, enjoy your stay and make sure to fix the typo in your Location information
_________________________



Top
#124639 - 2004-08-09 09:14 AM Re: Replace German Umlaute
Rainer_Piechura Offline
Fresh Scripter

Registered: 2004-08-09
Posts: 5
Loc: Bremerhaven, Germany
Hi Jochen, thanx for your help.
I tried $NAME = "Ändern,Wäsche,Überraschung,überwintern"
and it still comes up with "aendern,Waesche,ueberraschung,ueberwintern"

Any other ideas ?

Rainer

P.S. Changed the location, thanx......

Top
#124640 - 2004-08-09 09:30 AM Re: Replace German Umlaute
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Allright then,

at the beginning you have this line ?

Code:
$_ = SETOPTION("CaseSensitivity","ON")



And your Kixtart Version is which one ?

The last finallly released version is 4.22 so if you have the Setoption line and your version is 4.22 it should work ! (Can't find this Option in the development report though)
_________________________



Top
#124641 - 2004-08-09 09:34 AM Re: Replace German Umlaute
Rainer_Piechura Offline
Fresh Scripter

Registered: 2004-08-09
Posts: 5
Loc: Bremerhaven, Germany
Hi Jochen,
KiXtart 2001 4.22

Here ist the complete code again:
Code:

$_ = SETOPTION("CaseSensitivity","ON")

$NAME = "Ändern,Wäsche,Überraschung,überwintern"

while INSTR($NAME,"ä") or INSTR($NAME,"ö") or INSTR($NAME,"ü")
or INSTR($NAME,"Ä") or INSTR($NAME,"Ö") or INSTR($NAME,"Ü")
or INSTR($NAME,"ß") or INSTR($NAME," ")
SELECT
CASE INSTR($NAME,"ä")
$NAME = replace($NAME, "ä", "ae")
CASE INSTR($NAME,"ö")
$NAME = replace($NAME, "ö", "oe")
CASE INSTR($NAME,"ü")
$NAME = replace($NAME, "ü", "ue")
CASE INSTR($NAME,"Ä")
$NAME = replace($NAME, "Ä", "Ae")
CASE INSTR($NAME,"Ö")
$NAME = replace($NAME, "Ö", "Oe")
CASE INSTR($NAME,"Ü")
$NAME = replace($NAME, "Ü", "Ue")
CASE INSTR($NAME,"ß")
$NAME = replace($NAME, "ß", "ss")
CASE INSTR($NAME," ")
$NAME = replace($NAME, " ", "_")
ENDSELECT
loop

? $NAME

Function Replace($String,$SS,$RS)
$Replace=Join(Split($String,$SS),$RS)
EndFunction


Top
#124642 - 2004-08-09 09:52 AM Re: Replace German Umlaute
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Dang !

Can anybody confirm that CaseSensitivity was added to SetOption while 4.50 has entered private alpha build state ?

I can't as I haven't got my Notebook with me and downloads are disabled in our environment

Rainer, you can of course consult the manual that came with your release and look under SetOption if there is 'CaseSensitivity' mentioned
_________________________



Top
#124643 - 2004-08-09 12:04 PM Re: Replace German Umlaute
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Looks like Split() is not case sensitive - I just checked with 4.21 and 4.50.

This version using a different Replace seems to work ok, and you don't need to switch case sensitivity on:
Code:

$NAME = "Ändern,Wäsche,Überraschung,überwintern"

$NAME = replace($NAME, "Ä", "Ae")
$NAME = replace($NAME, "Ö", "Oe")
$NAME = replace($NAME, "Ü", "Ue")
$NAME = replace($NAME, "ß", "ss")
$NAME = replace($NAME, "ä", "ae")
$NAME = replace($NAME, "ö", "oe")
$NAME = replace($NAME, "ü", "ue")
$NAME = replace($NAME, " ", "_")

? $NAME

Function Replace($String,$SS,$RS)
While $String
If Left($String,1)==$SS
$Replace=CStr($Replace)+$RS
Else
$Replace=CStr($Replace)+Left($String,1)
EndIf
$String=SubStr($String,2)
Loop
EndFunction






Top
#124644 - 2004-08-09 12:15 PM Re: Replace German Umlaute
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Quote:

Looks like Split() is not case sensitive




Huh ?

I run this :

Code:
break on


$_ = SETOPTION("CaseSensitivity","ON")

$NAME = "Ändern,Wäsche,Überraschung,überwintern"

while INSTR($NAME,"ä") or INSTR($NAME,"ö") or INSTR($NAME,"ü")
or INSTR($NAME,"Ä") or INSTR($NAME,"Ö") or INSTR($NAME,"Ü")
or INSTR($NAME,"ß") or INSTR($NAME," ")
SELECT
CASE INSTR($NAME,"ä")
$NAME = replace($NAME, "ä", "ae")
CASE INSTR($NAME,"ö")
$NAME = replace($NAME, "ö", "oe")
CASE INSTR($NAME,"ü")
$NAME = replace($NAME, "ü", "ue")
CASE INSTR($NAME,"Ä")
$NAME = replace($NAME, "Ä", "Ae")
CASE INSTR($NAME,"Ö")
$NAME = replace($NAME, "Ö", "Oe")
CASE INSTR($NAME,"Ü")
$NAME = replace($NAME, "Ü", "Ue")
CASE INSTR($NAME,"ß")
$NAME = replace($NAME, "ß", "ss")
CASE INSTR($NAME," ")
$NAME = replace($NAME, " ", "_")
ENDSELECT
loop

? $NAME

get $
exit 1


Function Replace($String,$SS,$RS)
$Replace=Join(Split($String,$SS),$RS)
EndFunction



and what it returns is this :


Code:
Aendern,Waesche,Ueberraschung,ueberwintern



So it must be Case Sensitive, no?


Edited by Jochen (2004-08-09 12:17 PM)
_________________________



Top
#124645 - 2004-08-09 01:13 PM Re: Replace German Umlaute
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Just tried again with 4.21 and 4.50 (I don't have 4.22 to hand)

This simple test:
Code:
$=SetOption("CaseSensitivity","ON") ?
@KIX ?

$NAME = "Ändern Wäsche"

"Test string is: " $NAME ?
"Using Split/Join: " Replace_type1($NAME, "Ä", "Ae") ?
"Using character test: " Replace_type2($NAME, "Ä", "Ae") ?

Function Replace_type1($s,$t,$r)
$Replace_type1=Join(Split($s,$t),$r)
EndFunction

Function Replace_type2($String,$SS,$RS)
While $String
If Left($String,1)==$SS
$Replace_type2=CStr($Replace_type2)+$RS
Else
$Replace_type2=CStr($Replace_type2)+Left($String,1)
EndIf
$String=SubStr($String,2)
Loop
EndFunction



I get:
Code:
[KiXtart 4.21]
4.21
Test string is: Ändern Wäsche
Using Split/Join: Aendern WAesche
Using character test: Aendern Wäsche

[KiXtart 4.50]
4.50 Alpha TEST Release
Test string is: Ändern Wäsche
Using Split/Join: Aendern WAesche
Using character test: Aendern Wäsche


Top
#124646 - 2004-08-09 01:17 PM Re: Replace German Umlaute
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
odd thing

forgot to add @kix:

4.50 Alpha 2 Release

will try to test the above against 4.22 tonight
_________________________



Top
#124647 - 2004-08-10 06:18 AM Re: Replace German Umlaute
Rainer_Piechura Offline
Fresh Scripter

Registered: 2004-08-09
Posts: 5
Loc: Bremerhaven, Germany
Hi there,
when I'm using the replace function from Richard it works great. Maybe it also depends on the OS ??
Anyhow thanks for your help.

Rainer

Top
#124648 - 2004-08-10 08:24 AM Re: Replace German Umlaute
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Quote:

Hi there,
when I'm using the replace function from Richard it works great. Maybe it also depends on the OS ??
Anyhow thanks for your help.

Rainer





Ok then ... if it works for you and fits in perfectly
Depends on the OS ? Don't think so as Kixtart is pretty independant in those things (others like Macros might differ).

Maybe it is really true that Ruud added CaseSensitivity that late
However as this build isn't published yet you might better go with the solution that works, right ?
_________________________



Top
#124649 - 2004-08-10 11:08 AM Re: Replace German Umlaute
Rainer_Piechura Offline
Fresh Scripter

Registered: 2004-08-09
Posts: 5
Loc: Bremerhaven, Germany
Agree,

the Code from Richard works, let's see what 4.50 will do
to that Code

Thanx again............

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.115 seconds in which 0.073 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org