πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #264633

Re: [40tude] Edit -> Find regular expression?

#264633
From: mike
Date: Thu, 21 Jan 2021 22:44
76 lines
3722 bytes
Bernd Rose wrote:

> Shouldn't be too hard to adjust this script:
> http://web.archive.org/web/20120127150224/http://dialog.datalist.org/scripts/ScriptreplaceUmlaut.html

That script looks good since it removes things like the umlaut:
http://web.archive.org/web/20120127150224/http://dialog.datalist.org:80/scripts/ScriptreplaceUmlaut.html

(1) That URL has a minor syntax error (it's missing a single quote):
    CHANGE THIS: s:-StringReplace(s,'x,';yy);
    TO THIS: s:-StringReplace(s,'x',';yy);

(2) I already have an OnBeforeSending screipt, so since I'm NOT a
    programmer, I didn't want to mess with the existing 
    OnBeforeSending script, so I added that script you found as an
    OnBeforeSavingMessage script instead (with the quick syntax fix above,
    so that it compiled and saved).

(3) I then tested it using a cut and paste of German language web pages
https://www.studying-in-germany.org/german-umlauts/
https://blogs.transparent.com/german/umlauted-vowels-next-to-ordinary-vowels/
https://howtotypeanything.com/umlaut-letters/

My problem is when I press "Action -> Save & close draft", I expected 
this "OnBeforeSavingMessage" script to change the umlaut to ue before
saving the message as a draft - but it didn't change anything.

Do you know a test to invoke the "OnBeforeSavingMessage" script that is
better than "Action -> Save & close draft".

What I do I need to do to invoke the OnBeforeSavingMessage script below
so that when I save the message, the script removes the special characters?
-- 
program OnBeforeSavingMessage;

function StringReplace(S, OldPattern, NewPattern: string): string;
var
  SearchStr, Patt, NewStr: string;
  Offset: Integer;
begin
  SearchStr := S;
  Patt := OldPattern;
  NewStr := S;
  Result := '';
  while SearchStr <> '' do
  begin
    Offset := AnsiPos(Patt, SearchStr);
    if Offset = 0 then
    begin
      Result := Result + NewStr;
      Break;
    end;
    Result := Result + Copy(NewStr, 1, Offset - 1) + NewPattern;
    NewStr := Copy(NewStr, Offset + Length(OldPattern), 2147483647);
    SearchStr := Copy(SearchStr, Offset + Length(Patt), 2147483647);
  end;
end;

function OnBeforeSendingMessage(var Message: TStringlist; Servername:
string; IsEmail: boolean):boolean;
var s:string;
begin
result:=true;
s:=message.text;
s:=StringReplace(s,'ΓΌ','ue');
s:=stringreplace(s,'ΓΆ','oe');
s:=stringreplace(s,'Γ€','ae');
s:=stringreplace(s,'Ü','Ue');
s:=stringreplace(s,'Γ–','Oe');
s:=stringreplace(s,'Γ„','Ae');
s:=stringreplace(s,'ß','ss');
message.text:=s;
end;

begin
end.
Technical Details
Message-ID: <rud043$e9r$1@solani.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <ru5nfg$si7$1@solani.org> <3xo0b6k69bco$.dlg@v.nguard.lh> <ruagkd$j08$1@solani.org> <1gf2aqovcfhb8.dlg@v.nguard.lh> <rubuok$j1b$1@solani.org> <rubvif$jli$1@solani.org> <1pop06goudbzf$.dlg@b.rose.tmpbox.news.arcor.de>

Show Full Headers
Complete Article Headers
Message-ID: <rud043$e9r$1@solani.org>
Subject: Re: [40tude] Edit -> Find regular expression?
Date: Fri, 22 Jan 2021 04:14:19 +0530
From: mike <this@address.is.invalid>
References: <ru5nfg$si7$1@solani.org> <3xo0b6k69bco$.dlg@v.nguard.lh> <ruagkd$j08$1@solani.org> <1gf2aqovcfhb8.dlg@v.nguard.lh> <rubuok$j1b$1@solani.org> <rubvif$jli$1@solani.org> <1pop06goudbzf$.dlg@b.rose.tmpbox.news.arcor.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
X-User-Id: eJwNykkBwDAIBEBLkMBC5HD6l9DOe/SCUSZQiK5uZNMDJgOEyirijaLYZRWcQdtkkhn3kYj7XMe12/6b6/YBgkUW1w==
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 21 Jan 2021 22:44:20 -0000 (UTC)
Injection-Info: solani.org; logging-data="14651"; mail-complaints-to="abuse@news.solani.org"
Cancel-Lock: sha1:fNjBOIlKRetCCl0UzrrPvRFU83k=
User-Agent: 40tude_Dialog/2.0.15.41 (0c24496a.39.280)
Content-Type: text/plain; charset="us-ascii"
Newsgroups: news.software.readers