I think you might be confusing decimal and hexadecimal values. For example, hexadecimal 0x78 is lower-case x, but decimal 78 (hexadecimal 0x4e) is upper-case N.
In HTML, you can specify Unicode entities as either decimal using &#n; or as hexadecimal with &#xn; (where n is replaced with the decimal or hexadecimal character code). For a superscript 2, you'd could use either ² or ².
In your example code, you are decoding the entity N. This is a decimal entity, so you get the expected result (upper-case N). The Unicode tables you've linked to use hexadecimal. To get a lower-case x, you would have to use x as the input.