alexreinert/ARSoft.Tools.Net

Problems with Turkish character set

Opened this issue · 4 comments

Dear Alex,

We use your library to check SPF records in emails.

My colleague found a place where the library perform a case insensitive match for the word ‘include’ & ‘Include’ (by converting the word Include to lowercase). This works fine in Western European character sets, but fails in Turkish.

The verb here should be include (which it is when we run the tool locally on computers with Western European character sets, but on computers with Turkish character sets it becomes ‘Unknown’):

image

This means it does not expand some SPF records and the check fails.

Could you please verify or reproduce this? If yes, could you please fix this for us? Thank you!

Hi @alexreinert

We have managed to reproduce the issue and found its root cause. The problem occurs in the EnumHelper when the static constructor fills the _values field with a lowercase variant at line 44.
This particular issue happened with SpfMechanismType.Include which after the culture-sensitive ToLower call became ınclude in Turkish culture. This did not match the received include from the TxtRecord and became unknown as shown in the above picture.

see attachment:
image

Changing the conversion to use invariant culture seems to fix the issue. If you accept PR on this project we'd happily submit a small one addressing this particular issue.

Sorry, but for legal reasons I can not accept PRs. But I will provide a fix soon.

I understand. We appreciate your support!

Should be fixed in version 3.6.1