Whilst I cant comment on code you don’t show, the code you do show works by removing the trailing 00 (when viewing the variables as binary in the debugger) using this code:
[code]Dim theFilename As String
Dim s As String
s = “=?ISO-8859-1?Q?AntragPromotionser=F6ffnung=5FKBo=5Fv2.doc=00?=”
Dim a As String
a = DecodeQuotedPrintable(s)
Dim theRegex As New RegEx
theRegex.options.ReplaceAllMatches = True
theRegex.searchpattern = “\x00|\x01|\x02|\x03|\x04|\x05|\x06|\x07|\x08|\x0E|\x0F|\x10|\x11|\x12|\x13|\x14|\x15|\x16|\x17|\x18|\x19|\x1A|\x1B|\x1C|\x1D|\x1E”
theRegex.replacementPattern = “”
theFilename = theRegex.replace(a)
break[/code]
You’d have to post how you get name out of the string to try and find the issue as it seems that name isn’t correct if its throwing a NOE.
The code is part of my upcoming Mime Parser. However, base64 always works for unprintable characters. The following does’t remove the \x00:
[code]Dim theFilename As String
Dim s As String = “QW50cmFnUHJvbW90aW9uc2Vyw7ZmZm51bmdfS0JvX3YyLmRvYwA=”
s = DecodeBase64(s)
s = DefineEncoding(s, Encodings.UTF8)
Dim theRegex As New RegEx
theRegex.options.ReplaceAllMatches = True
theRegex.searchpattern = “\x0[xX][A-Fa-f0-9]+”
theRegex.replacementPattern = “”
theFilename = theRegex.replace(s)[/code]
In both s and theFilename I can see the \x00 at the end of the string.
Dim s As String = “QW50cmFnUHJvbW90aW9uc2Vyw7ZmZm51bmdfS0JvX3YyLmRvYwA=”
s = DecodeBase64(s)
s = DefineEncoding(s, Encodings.UTF8)
Dim theRegex As New RegEx
theRegex.options.ReplaceAllMatches = True
theRegex.searchpattern = “\x00|\x01|\x02|\x03|\x04|\x05|\x06|\x07|\x08|\x0E|\x0F|\x10|\x11|\x12|\x13|\x14|\x15|\x16|\x17|\x18|\x19|\x1A|\x1B|\x1C|\x1D|\x1E”
theRegex.replacementPattern = “”
theFilename = theRegex.replace(s)[/code]
Works fine here, Windows 10, 2018r4
[code]Dim theFilename As String
Dim s As String = “QW50cmFnUHJvbW90aW9uc2Vyw7ZmZm51bmdfS0JvX3YyLmRvYwA=”
s = DecodeBase64(s)
s = DefineEncoding(s, Encodings.UTF8)
Dim theRegex As New RegEx
theRegex.options.ReplaceAllMatches = True
theRegex.searchpattern = “\x0[xX][A-Fa-f0-9]+”
theRegex.replacementPattern = “”