Use json_encode to encode values for the autocomplete boxes.

Use json_encode handle the encoding.