3

I have created web-service to get data from database which is in Gujarati(other language).

While i am accessing that URL of web-service in browser i am getting "????????????" instead of real data.

Please help me to get out of it.

Thanks

2
  • depends on what encoding does the website use, and what encoding do you use in browser
    – Gntem
    Aug 17, 2012 at 12:14
  • bdia question rahul, I upvoted
    – Patt Mehta
    Aug 17, 2012 at 12:31

2 Answers 2

2

you have to set encoding

ini_set('default_charset', 'utf-8');

on your webservice php file.

3
1

Rahul bhai, try to run this script first:

<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "test");

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

/* change character set to utf8 */
if (!$mysqli->set_charset("utf8")) {
    printf("Error loading character set utf8: %s\n", $mysqli->error);
} else {
    printf("Current character set: %s\n", $mysqli->character_set_name());
}

$mysqli->close();
?

If you can modify the web-service, try to set charset to utf-8 as shown above, or browse stackoverflow for similar questions, where users ask to set charset etc

1
  • Rahul bhai plz 'upvote'/'mark as answer' if this solves your problem
    – Patt Mehta
    Aug 17, 2012 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.