Parsing UTF-8

Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
Post Reply
U-351
New user
New user
Posts: 13
Joined: 2014-11-13 15:13

Parsing UTF-8

Post by U-351 » 2020-11-19 09:16

Hi
I trying make a message forwardng by condition

Code: Select all

...
	If (InStr(oMessage.Subject,rutflag)>0) Then 
		oMessage.AddRecipient "Server_Forward","xxx@yyy.zzz"
	      oMessage.RefreshContent()
	      oMessage.Save
	End If
...
If rutflag is latin - strinig routine work normal.
If rutflag is non-latin/cyrylic - routine no work.

In message i seen
---
Subject: =?UTF-8?B?0KDRg9GC0LXQutGB?=
---

Is it possible to search for a substring in UTF-8?

User avatar
SorenR
Senior user
Senior user
Posts: 4194
Joined: 2006-08-21 15:38
Location: Denmark

Re: Parsing UTF-8

Post by SorenR » 2020-11-19 14:19

Code: Select all

   Dim ECFlag, SFlag : SFlag = False
   ECFlag = oMessage.EncodeFields

   '  Use RAW data
   oMessage.EncodeFields = False

   If InStr(1, oMessage.Subject, "?koi8-r", 1) > 0 Then

      '  Do STUFF ... Set SFlag if content is changed.
      SFlag = True

   End If
   If SFlag Then oMessage.Save

   '  Restore MIME decoding
   oMessage.EncodeFields = ECFlag
SørenR.

Algorithm (noun.)
Word used by programmers when they do not want to explain what they did.

U-351
New user
New user
Posts: 13
Joined: 2014-11-13 15:13

Re: Parsing UTF-8

Post by U-351 » 2020-11-20 14:04

Thank You!
Solved problem another way.

Add regexp rule and add Simple routine on it. Thus, the string conversion is done by the server engine.

Post Reply