util: fix apostrophe handling and its tests