Fix escaping in char_link and add tests

Same logic as 2301e4c