<form enctype="multipart/form-data" method="post" action="mailto:[email protected]" accept-charset="UTF-8">
Is there a problem if mails are sent this way .. i wanna avoid using PHP codes..
I'm looking for a simple way to forget that I'm using a WebView to have justified text in my TextView. Has someone made a custom view for this? I'm well aware that I can do something like this:
WebView view = new WebView(this);
view.loadData("my html with text justification","text/html","utf-8");
But it gets ugly when you want to set the size, the color or other common properties of the TextView, there must be a more convenient way of doing it.
Hi,
I run this snippet twice, in the ubuntu terminal, (encoding set to utf-8) once with ./test.py and then with ./test.py >out.txt:
uni = u"\u001A\u0BC3\u1451\U0001D10C"
print uni
Without redirection it prints garbage. With redirection I get a UnicodeDecodeError. Can someone explain why I get the error only in the second case, or even better give a detailed explanation of what's going on behind the curtain in both cases?
I attempt to use webservice return POCO class generated from entity data model as JSON when using Jquery AJAX call method in webservice. but I have problem with error "Only Web services with a [ScriptService] attribute on the class definition can be called from script", and getting stuck in it,
Here is my code :
namespace CarCareCenter.Web.Admin.Services
{
/// <summary>
/// Summary description for About
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class About : System.Web.Services.WebService
{
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
[WebMethod]
public static Entities.Category getAbout()
{
Entities.Category about = new Entities.Category();
using (var context = new CarCareCenterDataEntities())
{
about = (from c in context.Categories where c.Type == "About" select c).SingleOrDefault();
}
return about;
}
}
}
aspx page :
<script type="text/javascript">
$(document).ready(function () {
$.ajax({
type: 'POST',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
url: '/Services/About.asmx/getAbout',
data: '{}',
success: function (response) {
var aboutContent = response.d;
alert(aboutContent);
$('#title-en').val(aboutContent.Name);
$('#title-vn').val(aboutContent.NameVn);
$('#content-en').val(aboutContent.Description);
$('#content-vn').val(aboutContent.DescriptionVn);
$('#id').val(aboutContent.CategoryId);
},
failure: function (message) {
alert(message);
},
error: function (result) {
alert(result);
}
});
$('#SaveChange').bind('click', function () { updateAbout(); return false; });
$('#Reset').bind('click', function () { getAbout(); return false; })
});
function updateAbout() {
var abt = {
"CategoryId": $('#id').val(),
"Name": $('#title-en').val(),
"NameVn": $('#title-vn').val(),
"Description": $('#content-en').val(),
"DescriptionVn": $('#content-vn').val()
};
$.ajax({
type: "POST",
url: "AboutManagement.aspx/updateAbout",
data: JSON.stringify(abt),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var aboutContent = response.d;
$('#title-en').val(aboutContent.Name);
$('#title-vn').val(aboutContent.NameVn);
$('#content-en').val(aboutContent.Description);
$('#content-vn').val(aboutContent.DescriptionVn);
},
failure: function (message) {
alert(message);
},
error: function (result) {
alert(result);
}
});
}
</script>
Do any approaches to solve it ? Please help me . Thanks
For example, I need to make the following Client C - Server S conversation and get XIMSS.nonce node value:
C:GET /ximsslogin/ HTTP/1.1
Host: myserver.com
Content-Type: text/xml
Content-Length: 42
<XIMSS><listFeatures id="list" /><XIMSS>
S:HTTP/1.1 200 OK
Content-Length: 231
Connection: keep-alive
Content-Type: text/xml;charset=utf-8
Server: CommuniGatePro/5.3
<XIMSS><nonce>2C3E575E5498CE63574D40F18D00C873</nonce><language>german</language><response id="s"/></XIMSS>
Hi guys,
I need to save files with non-latin filenames on a filesytem, using PHP.
I want to make this work cross-platform. How do I know what encoding I can use to write the file? I understand many modern filesystems are UTF-8 based (is this correct?), but I doubt Windows XP is (for instance).
So, is there a robust detection mechanism?
Evert
Well, the subject says everything. I'm using json_encode to convert some UTF8 data to JSON and I need to transfer it to some layer that is currently ASCII-only. So I wonder whether I need to make it UTF-8 aware, or can I leave it as it is.
I can not assign a xml scripts in to a php variable.
My xml text:
<?xml version="1.0" encoding="UTF-8" ?><rss version="2.0"><channel>
<title>coolajax.net</title>
<link>http://www.hotscripts.com/listings/feed</link>
<description>Coolajax Scripts Listings Description</description>
and I want to assign this text in to $xml_header variable.
can anyone help me..
Hey, I have some code which queries a web server using HTTP GET
URLConnection connection = new URL("www.example.com" + "?blah=ok").openConnection();
connection.setRequestProperty("Accept-Charset", "UTF-8");
InputStream http_response = connection.getInputStream();
Now when I run this code while connected to WiFi I get the expected response but when I run this with WiFi disabled I instead seem to get the response of www.example.com without the appended query.
Does anyone know why this is happening?
I just got my free web hosting set up (trigoblocks.comuf.com), I connected via FileZilla FTP and uploaded my files. The error I get is "Parse error: syntax error, unexpected T_STRING in /home/a3639879/public_html/header.php on line 1".
Header.php line 1-2:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
I do not get this error while on localhost with XAMPP.
Hey,
Currently i try to create some of my database export work more automated and i decided to go with exporting data from MySql database to .doc file in php.
So im doing some database work and store complete html to a $str variable and then write/make new file:
$fp = fopen($file, 'w+');
fwrite($fp,$str);
fclose($fp);
The problem here is not creating .doc file, but when i download and view that .doc file it's not in UTF-8 it's in unicode.
Hey everyone,
So my setup for my web application is that I have a general header and footer and then I just include them in all my other pages so that all the common elements for all the pages are in a single page. The only problem I'm running into is when I want to redirect the user back to a login page if the "username" session has not already been created.
The problem that I"m running into is that I have an if statement at the top of my header.jsp and then I have the else in the footer.jsp and it is giving me a java syntax error. Any ideas? Here is the code I'm referring to...
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
if(session.getAttribute("username") != null)
{
%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<!-- CSS files -->
<link rel="stylesheet" href="../CSS/headerStyle.css" type="text/css" media="screen" />
<title>Insert title here</title>
</head>
<body>
<div id="container">
<div id="header">
<div id="headerTitle">Title</div>
</div>
</div>
<%} %>
And then here is the footer
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../CSS/headerStyle.css" type="text/css" media="screen" />
</head>
<body>
<div id="footer"></div>
</body>
</html>
<%
else
{
response.sendRedirect("../wa_login/login.jsp");
}
%>
However it is giving me an error on the else statement because the else doesn't have an if statement because it's in the header file.
Hi,
From my asp application, i am trying to open a csv file onto ie8. The same code is working fine on ie6 although. Below is the code:
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath
ContentType = "application/msexcel"
Response.AddHeader "Content-Disposition", "attachment; filename=" & strFileName
Response.AddHeader "Content-Length", strFileSize
Response.Charset = "UTF-8"
Response.ContentType = ContentType
Response.BinaryWrite objStream.Read
Response.Flush
objStream.Close
Please help me undestand where i am going wrong.
i am trying to get EmployeeId withitn the DOM something like this:
var o = obj[$(this).attr("EmployeeId")];
but getting undefined
when i debug i see the following:
$(this)[0].data
data "{EmployeeId: 'A42345'}"
here is my source code:
$.ajax({
type: "POST",
url: url,
data: "{EmployeeId: '" + id + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var obj = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d;
var o = obj[$(this).attr("EmployeeId")]; //<<<<undefined
Hi, I'm using this XML classes for the first time and can't find this piece of info.
I'm doing:
xmlDoc = new XDocument(new XDeclaration("1.0", "utf-8", "yes"));
xmlDoc.Add(new XElement("Images"));
xmlDoc .Save("C:\\Backup\\images.xml");
But doesn't work. It only works if I use just the filename, like "images.xml", but of course, the file gets saved on the execution path.
I am new to Ajax. In my Ajax I get the following error message :
Notice: Undefined index: address in C:\wamp\www\test\sample.php on
line 11
I googled but I didn't get a solution for my specified issue.
Here is what I did.
HTML Form with Ajax (test1.php)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
function loadXMLDoc()
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("mydiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("POST","test2.php",true);
xmlhttp.send();
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="sample.php">
<p>
<label for="mail"></label>
<input type="text" name="mail" id="mail" onblur="loadXMLDoc()" />
<input type="submit" name="submit" id="submit" value="Submit" />
</p>
<p><div id = 'mydiv'></div></p>
</form>
</body>
</html>
test2.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
echo "Your Address is ".$_POST['address'];
?>
</body>
</html>
I am sure it is very simple issue but I don't know how to solve it. Any help ?
What is the difference between charsets and character encoding? When i say i am using utf-8 encoding then what will be my charset? Does it take unicode as charset by default?
in some of the websites i have, when adding to favorite with IE button the name of the favorite that is auto filled in by the page title is sometimes not getting the name and insted it gets the url where the "/" is replaced by "-" and ":" is removed
what is the problem?
the websites are hebrew or english, encoding is utf-8 or windows-1255...
i used Zend Studio for eclipse, and now i have a problem with encoding.
when i try to write text in foreign language, it doesn't understand the font. but in browser it shows normally.
i've set then default encoding to UTF-8, but it doesn't work.
could you help me.
Thanks
I've got this function for encrypting passwords in Java, but somehow when I call
MessageDigest, it returns a different result every time even though I call it with the same password. I wonder if I am initializing it wrong somehow.
public String encrypt (String password) {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.reset();
md.update(password.getBytes(Charset.forName("utf-8")),0,password.length());
String res = md.digest().toString();
}
I have tried to find out why JSON is not working in Firefox all over this forum and the internet. It works on tablets, ie, safari. It works on my desktop in firefox. It only does not work after uploading I've tried a few things (commented out), such as mimeType with no solution. I have tried using the $.ajax with no better luck. Firefox had no javascript errors. I'm using jQuery 1.7.
Console.log is printing out the data.
$(document).ready(function(){
jQuery.support.cors = true;
//$.ajaxSetup({ mimeType: "application/json" });
/*$.ajaxSetup({ scriptCharset: "utf-8" , contentType: "application/json; charset=utf-8"}); */
// loading pictures
$.getJSON("intro.json?format=json", function(data){
var links = '';
var imageload = '';
var title = '';
console.log(data)
$.each(data, function(key, item){
links += ' <a href=' + item.image + '>' + key + '</a>';
imageload += '<img src="' + item.image + ' " />';
title += item.alt;
});
$('.introCon').html(imageload);
$('.introCon img').hide();
$('.introCon img:last').fadeIn(500);
$('.introCon img').fadeIn(1000);
rotatePics(2);
});
});
function rotatePics(currentPhoto) {
var numberOfPhotos = $('.introCon img').length;
currentPhoto = currentPhoto % numberOfPhotos;
$('.introCon img').eq(currentPhoto).fadeOut( function() {
// re-order the z-index
$('.introCon img').each(function(i) {
$(this).css(
'zIndex', ((numberOfPhotos - i) + currentPhoto) % numberOfPhotos
);
});
$(this).show();
setTimeout(function() {rotatePics(++currentPhoto);}, 3000);
});
}
Here is the simple JSON from a separate file.
{
"1" : {
"image" : "portfolio/chrpic.png",
"alt" : "Blah.",
"detail": "Quartz"},
"2" : {
"image" : "portfolio/mysspic.png",
"alt" : "Landing page.",
"detail": "Container"},
"3" : {
"image" : "portfolio/decode-pic3.png",
"alt" : "Decode this.",
"detail": "Landing page 2"},
"4" : {
"image" : "portfolio/simple-think-pic.png",
"alt" : "Simple Think",
"detail": "simpilify your life"}
}
Now, I have two Java classes like this.
public class HogeDomain {
private User userDomain;
public HogeDomain() {
}
and getter/setter..
}
public class User {
public User() {
}
private String id;
private String password;
private Date userDate;
and getter/setter..
}
And then, I created a xml schema above for using "Schemagen" of an Ant task automatically.
It's this.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="hogeDomain">
<xs:sequence>
<xs:element name="userDomain" type="user" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="user">
<xs:sequence>
<xs:element name="id" type="xs:string" minOccurs="0"/>
<xs:element name="password" type="xs:string" minOccurs="0"/>
<xs:element name="userDate" type="xs:dateTime" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
But I really want to create a xml schema like this to using JAXB marshalling or unmarshalling.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="hogeDomain">
<xs:sequence>
<xs:element name="userDomain" type="user" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="user">
<xs:complexType>
<xs:sequence>
<xs:element name="id" type="xs:string" minOccurs="0"/>
<xs:element name="password" type="xs:string" minOccurs="0"/>
<xs:element name="userDate" type="xs:dateTime" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
How to create this xml schema for using a "Schemagen" Ant task ?
I don't want to write a xml schema for hand-made.
And is there any solutions when if it can't ?
i am developing an application in which i get the unicode using json and it showing correctly the unicode when i am trying to see in the debug mode,Now the problem is that how can i show in the emulator,i have using the UTF-8 for rendering the unicode bt it didn't show ?
And when i am trying to show in using the setTypeface it showing the Telugu font in a simple program even but not correctly.i am using the Pothana2000.ttf to convert the telugu unicode to Telugu language.
Suggestions welcome.Need reply urgently.
I am attempting to follow the Google Map View under the views tutorial for the Android. I have followed step by step but still only see grey blocks when viewed.
First: I created a Virtual Device using "Google API's(Google Inc.) Platform 2.2 API Level 8"
Second: When creating my project I selected "Google API's Google Inc. Platform 2.2 API Level 8".
Third: I obtained the SDK Debug Certificate
Fouth: Began Coding.
Main.xml
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="0l4sCTTyRmXTNo7k8DREHvEaLar2UmHGwnhZVHQ"
/
HelloGoogleMaps.java
package com.example.googlemap;
import android.app.Activity;
import android.os.Bundle;
import com.google.android.maps.MapView;
import com.google.android.maps.MapActivity;
public class HelloGoogleMaps extends MapActivity
{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
HelloGoogleMaps Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.googlemap"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".HelloGoogleMaps" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest>
Any thoughts??
Thanks!
class sss(webapp.RequestHandler):
def get(self):
url = "http://www.google.com/"
result = urlfetch.fetch(url)
if result.status_code == 200:
self.response.out.write(result.content)
and this view show :
when i change code to this:
if result.status_code == 200:
self.response.out.write(result.content.decode('utf-8').encode('gb2312'))
it show :
so ,what i should do ?
thanks