Question about ASP/VBScript strings and MidB values.

I've looked for detailed information regarding the double-byte nature of ASP/VBScript strings but I can't find anything.  I have noticed that if you get, say, Mid(s, i, 1) and MidB(s, 2 * i), 1), the values are different.  The MidB values seems to be 0 in most ASCII strings, but is sometimes the same as the Mid value in strings with extended characters in, and is sometimes something different (often a more exact value) in other extended strings (like hebrew ones).

Can anyone explain what exactly in in there?
LVL 31
LeeDerbyshireAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

thefritterfatboyCommented:
MID is intended for use with languages that use the single-byte character set (SBCS), whereas MIDB is intended for use with languages that use the double-byte character set (DBCS). The default language setting on your computer affects the return value in the following way:

MID always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

MIDB counts each double-byte character as 2 when you have enabled the editing of a language that supports DBCS and then set it as the default language. Otherwise, MIDB counts each character as 1.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.