We pass the message text through what is called a regular expression (RegEx). I believe this is Perl code that is executed by PHP. In the regular expression, we specify for it to ignore differences in case. By default, it either uses the ASCII character set or the server default character set. Either way, we can't change the set that it uses with certainty except by telling it to use unicode (UTF-8), and this is only if PHP is compiled with multi-byte character support.
The characters in character sets are numbered, and contains information about which characters are different cases of each other. The first 255 characters in a set are typically the same no matter which one is used, from what I remember (directly the ASCII set).
In the case of Windows-1251 input into RegEx, the compiler can't distinguish upper-case or lower-case for characters that aren't within those first 255 characters - it doesn't know what id # pairs are upper or lower case because it's not familiar with the character set we're using. As a result, even though the characters may be upper/lower-case pairs, it reports them as different characters, and the auto-link is not recognized as valid.