|
Thread.CurrentThread.CurrentCulture = new CultureInfo("hu");
string mechanism = "HMACSHA256";
var v1 = mechanism.StartsWith("HMAC");
mechanism = "HMAC-SHA256";
var v2 = mechanism.StartsWith("HMAC");
Result : v1 is false, but v2 is true.
I was too lazy for using StringComparison.Ordinal, since, in my code all the strings were hardcoded... No way, ever, a bug would happen... Until an hungarian used it.
Apparently, if you are hungarian, "CS" is counted as 1 letter, BUT in unicode this is 2 letters...
modified 29-Apr-15 10:30am.
|
|
|
|
|
Might be worth checking Welsh (cy-GB) too..
Welsh Alphabet[^]
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
Yes, Hungarian has a few letters that are 2 characters long and one that is 3. So depending on culture settings this can get taken into account (same for SQL Server etc.). Unfortunately, as with other culture or datetime related problems there are weird corner cases. For example the word "pácsó" (meaning curing salt) consists of two parts, "pác" and "só", so even though c and s are next to each other they are two different letters and pronounced as such. Needless to say the computer has no way of knowing this, so StartsWith("pác") returns false for "hu" culture setting, which strictly speaking is incorrect. Cultures are hard...
|
|
|
|
|
Cultures are hard...
Well, at this point I see no reason over not using StringComparison.InvariantCulture/CultureInfo.InvariantCulture in any code.
In fact, this should be the default.
|
|
|
|
|
And CCS is actually two CS's not a C and CS.
There are over forty characters in the Hungarian Alphabet and a fair few are dipthongs, with evan a three letter letter one as well - clickity[^]
veni bibi saltavi
|
|
|
|
|
Clearly, the solution is to keep Hungarians away from computers.
|
|
|
|
|
|
I would have to sell my stock!
Mongo: Mongo only pawn... in game of life.
|
|
|
|
|
veni bibi saltavi
|
|
|
|
|
|
Well, the problem is that even if you try to do it with this code :
if(Thread.CurrentThread.CurrentCulture.ToString().StartWith("hu"))
{
throw new HttpException("Not authorized");
}
You are not even sure it will works correctly.
|
|
|
|
|
When you are dead, you don't know that you are dead. It is only difficult for other people.
The same goes for stupid.
veni bibi saltavi
|
|
|
|
|
Ooohh, deep.. but how do you know that you don't know that you're dead when you're dead?
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
Whoever replies to Brent's message, please don't hurt his feelings by referencing the 'stupid' part of the post.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "As far as we know, our computer has never had an undetected error." - Weisert | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
W∴ Balboos wrote: please don't hurt his feelings by referencing the 'stupid' Don't quite see why that would hurt his feelings. Only an atheist knows you don't know you're dead when you are dead. There is another class of people who know that you would know you are dead. (Depending on which place you are sent would determine if it was or wasn't a pleasant experience. Neither class can prove they are right, they just know they are right and the other class is wrong. I choose to sit on the fence and not decide which of them is right. I guess that either will send me to hell or oblivion when my time comes. I probably will regret my life choices if I go to hell, but I'd probably blame someone else for not making it obvious that it exists and which religion has its existance right.
|
|
|
|
|
W∴ Balboos wrote: please don't hurt his feelings by referencing the 'stupid' Don't quite see why that would hurt his feelings. Only an atheist knows you don't know you're dead when you are dead. There is another class of people who know that you would know you are dead. (Depending on which place you are sent would determine if it was or wasn't a pleasant experience.) Neither class can prove they are right, they just know they are right and the other class is wrong. I choose to sit on the fence and not decide which of them is right. I guess that either will send me to hell or oblivion when my time comes. I probably will regret my life choices if I go to hell, but I'd probably blame someone else for not making it obvious that it exists and which religion has its existence right.
modified 1-May-15 1:14am.
|
|
|
|
|
That is honestly a very smart question.
This is thinking outside the box.
You know you are getting close when you ask the question that cannot be answered.
|
|
|
|
|
yeah leave him in that thinking and we all be safe
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
newton.saber wrote: You know you are getting close when you ask the question that cannot be answered.
It can be answered, I just don't want to find out right now
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
You just keep on getting smarter.
|
|
|
|
|
That's what I call "the CodeProject effect"
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
How are you gonna answer then?
Wout
|
|
|
|
|
I'll post it here of course
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
So you're calling the lounge dead huh?
Wout
|
|
|
|
|
Dead or... what was the other option?
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
modified 31-Aug-21 21:01pm.
|
|
|
|