بروز خطا
[message]
اشتراک در سوال
رای ها
[dataList]
نمایش حروف فارسی بصورت ؟؟؟؟؟؟
سلام دوستان . وقت بخیر
مشکلی که واسم پیش اومده مربوط میشه به ارسال اطلاعات به سرور از طریق اپ اندروید
حروف داخل هاست قرار میگیره اما بصورت ؟؟؟؟؟
new Webservice(RegisterPage.this).execute(".../insert.php?codenation="+CodeNation+"&personname="+Person+"&byid="+ByID);
روی سرور برابر آموزش های LAMP همه ی تنظیمات رو اوکی کردم
این هم سورس webservice
public class Webservice extends AsyncTask<String, Void, String> {
private static Context context;
public Webservice(Context c) {
context = c;
}
@Override
protected String doInBackground(String... params) {
// These two need to be declared outside the try/catch
// so that they can be closed in the finally block.
HttpURLConnection urlConnection = null;
BufferedReader reader = null;
String Link = params[0];
// Will contain the raw JSON response as a string.
String forecastJsonStr = null;
try {
// Construct the URL for the OpenWeatherMap query
// Possible parameters are avaiable at OWM's forecast API page, at
// http://openweathermap.org/API#forecast
URL url = new URL(Link);
// Create the request to OpenWeatherMap, and open the connection
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.connect();
// Read the input stream into a String
InputStream inputStream = urlConnection.getInputStream();
StringBuffer buffer = new StringBuffer();
if (inputStream == null) {
// Nothing to do.
return null;
}
reader = new BufferedReader(new InputStreamReader(inputStream));
String line;
while ((line = reader.readLine()) != null) {
// Since it's JSON, adding a newline isn't necessary (it won't affect parsing)
// But it does make debugging a *lot* easier if you print out the completed
// buffer for debugging.
buffer.append(line + "\n");
}
if (buffer.length() == 0) {
// Stream was empty. No point in parsing.
return null;
}
forecastJsonStr = buffer.toString();
return forecastJsonStr;
} catch (IOException e) {
Log.e("PlaceholderFragment", "Error ", e);
// If the code didn't successfully get the weather data, there's no point in attemping
// to parse it.
return null;
} finally{
if (urlConnection != null) {
urlConnection.disconnect();
}
if (reader != null) {
try {
reader.close();
} catch (final IOException e) {
Log.e("PlaceholderFragment", "Error closing stream", e);
}
}
}
}
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
//Toast.makeText(context, s, Toast.LENGTH_SHORT).show();
}
برای این سوال 1 پاسخ وجود دارد.
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .