rogersce / cnpy

library to read/write .npy and .npz files in C/C++
MIT License
1.34k stars 301 forks source link

Multiply word_size by 4 in parse_npy_header for dtype 'U' #55

Open sjmielke opened 5 years ago

sjmielke commented 5 years ago

For Unicode data, the NumPy "length" refers to characters, not bytes, specifically UCS-4/UTF-32 encoded characters, so we need 4 bytes of storage for each element.