0

I'm trying to convert a array of ASCII encoded email into utf-8 or plaintext format or readable. I tried to use utf8_encode($str); to encode, but its not working with array. Here is my code (php).

foreach ($datas as $values) {
    echo utf8_encode($values)."<br/>";
}

Here is the array.

Array (
[0] => \0E\0-\0m\0a\0i\0l\0 \01\0 \0-\0 \0V\0a\0l\0u\0e\0
[1] => \0v\0a\0r\0a\0d\0a\0l\0a\0k\0s\0h\0m\0i\01\02\03\0@\0g\0m\0a\0i\0l\0.\0c\0o\0m\0
[2] => \0s\0a\0l\0v\0i\0n\0w\0i\0l\0s\0o\0n\0@\0g\0m\0a\0i\0l\0.\0c\0o\0m\0
[3] => \0s\0h\0e\0m\0e\0e\0m\0@\0g\0m\0a\0i\0l\0.\0c\0o\0m\0
)
4
  • 1
    ASCII is a subset of UTF-8. No need to convert: it is already UTF-8. Commented May 27, 2015 at 17:19
  • And what does $datas contain? Commented May 27, 2015 at 17:20
  • $datas contain the array i gave in question. Commented May 27, 2015 at 17:23
  • The output i'm getting is \0v\0a\0r\0a\0d\0a\0l\0a\0k\0s\0h\0m\0i\01\02\03\0@\0g\0m\0a\0i\0l\0.\0c\0o\0m\0 \0s\0a\0l\0v\0i\0n\0w\0i\0l\0s\0o\0n\0@\0g\0m\0a\0i\0l\0.\0c\0o\0m\0 \0s\0h\0e\0m\0e\0e\0m\0@\0g\0m\0a\0i\0l\0.\0c\0o\0m\0 i need the output like [email protected] (email format). Commented May 27, 2015 at 17:24

1 Answer 1

1

Make a brutal

foreach ($datas as $values) {
    echo str_replace('\\0', '', $values)."<br/>";
}

However, where did you get this data?

Sign up to request clarification or add additional context in comments.

1 Comment

Google Contacts CSV export.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.