1

When I assign my str variable to a text file like so...

Open fl.Path For Input As #1
        Do Until EOF(1)
            Line Input #1, temp
            str = str & temp
        Loop
Close #1

I noticed that when I look into my string with the mid function, the apostrophe character seems to turn into ’.

This is particularly problem for me because the above is three characters long, instead of only 1 character. This offsets the rest of my string manipulations so that basically everything is wrong.

I'm not really familiar with the different kinds of encoding and how it relates to VBA Excel, but maybe there is an easy way to fix this?

I could try to create some defensive coding to counter this, but I'm wondering if there is a more "legit" way.

Community
  • 1
  • 1
bmende
  • 741
  • 1
  • 11
  • 24
  • 3
    It's an encoding problem - [this answer](http://stackoverflow.com/a/2477480/2127508) explains what the issue is – barrowc Apr 27 '16 at 02:30
  • 2
    @barrowc has directed you to the explanation you need. Nothing you can code up will work reliably unless you read that answer, **and** the link at the end of it, to Joel Spolsky's famous blog post [The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets](http://www.joelonsoftware.com/articles/Unicode.html) – Nigel Heffernan Apr 27 '16 at 10:03

0 Answers0