ansi is not an encoding, it's an organisation. Did you mean ascii, which is a charset and an encoding, created by the ansi organisation? Or perhaps you mean iso-8859-1, which is another charset/encoding, incidentally being a superset of ascii.
Unicode is not an encoding either - It's a charset. There are several encodings capable of representing the unicode charset. For example utf-8.
Most encodings - including those capable of representing unicode - are ascii-compatible.
php is mostly ignorant of encodings, as long as they are ascii-compatible.