Android :: Web View Encoding? Why?
May 28, 2010
I have started to work with the WebView component of Android Platform, but the API to load data to the component is confusing me, because it includes a parameter with a encoding. In both methods: public void loadData (String data, String mimeType, String encoding); public void loadDataWithBaseURL (String baseUrl, String data, String mimeType, String encoding, String historyUrl); you have to specify an encoding. In both cases, the API documentation says that is is the encodign of the data (data parameter). Well, as know, if you provide data as a String object, the String is internally stored in UTF-16 (unicode). To get a String object from a external source, you need to specify the external source encoding to convert it to UTF-16 and get the String internal representation (String(byte[] data, String encoding)). So, at this moment, when you have an String instance, everything from the original source has been converted to UTF-16. So, why do you need to specify an encoding if you are providing the data as a String object?
I don't know the internal implementation of WebKit, but let's suppose that, WebKit has a method, to render a source, providing as content an InputStream and a default encoding. Well, as I know, when you process a HTML page, you use the default encoding to read the HTML characters, and if you find a <meta> tag specifing a different encoding, from that moment, you have to use the new encoding to decode the characters of the HTML page. But what happens if you supply a HTML page that contains this <meta> tag: <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=ISO-8859-1"/> using one of the methods specified at the top of this post, how are you going to read ISO-8859-1 encoding from a String that it is in UTF-16 encoding? if the WebKit filtering this <meta> tags, and doesn't taking in account the encoding specified in this tag? Well, all of this is very confusing for me, because I don't understand why the API includes this encoding parameter. I also don't know if the <meta> encoding tags are filtered when the source is provided as a String? Can anyone solve my doubts?
View 2 Replies
Nov 19, 2010
I am facing a problem about encoding.
For example,
I have a message in xml format encoding is "UTF-8".
CODE:.........
Now, this message are supporting multiple language.
Traditional Chinese (big5), Simple Chinese (gb), English (utf-8)
And it will only change the encoding in specific fields.
For example (Traditional Chinese),
CODE:..........
Only "蘋果" and "橙" are using big5, "<product_name>" and "</product_name>" stills in use utf-8.
<price>1.3</price> and <price>1.2</price> are using utf-8.
How do I know which word is using different encoding?
View 3 Replies
View Related
Aug 24, 2010
I'm working on an application using the SMS apis for android. The receiving end is an embedded unit that only supports 7-bit encoded SMS and the string I'm sending consists only of symbols from this particular alphabet which makes you think that Android is going to send it encoded as 7 bit. But that is not the case.Therefore I'm searching for a way to specify what encoding to use. See below for what my code looks like today. The method gsm7BitPackedToString turns a byte-array to a 7-bit string, i.e. the string only consists of 7-bit compatible characters and is copied from the internal android api. Code...
View 2 Replies
View Related
Feb 5, 2010
What is the default encoding of android system?
View 1 Replies
View Related
Mar 15, 2010
Assume I want to write an xml resource file with a a non-europian language, say japanese, thai or chinese-What encodings can I use and what do I have to to to both the xml header and the Writer to makes these work - Also is there an easy way to map a Locale into acceptable encodings
View 4 Replies
View Related
Apr 8, 2009
I've added one new feature to Opencore & Framework to let them support encoding qcelp. But I found that Eclipse cannot figure out this new feature, e.g.
recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_QCELP);recorder.setAudioEncoder(MediaRecorder.AudioEncoder.QCELP);
Eclipse now does not think RAW_QCELP & QCELP as legal symbols. So, what should I do to update the SDK to pass though this issue? Overwrite its system.img, boot.img or some *.jar packages?
View 3 Replies
View Related
Mar 3, 2010
I found a problem with GZIP input stream when wrapping InputStream from HttpURLConnection. When the server response with Transfer- Encoding=chunked, Content-Encoding=gzip and Connection=Keep-Alive. The second post always return -1. After digging into the source code, I found the place that could be a bug: InflaterInputStream.java (line 190 to 192) if (inf.needsInput()) { fill(); } Because InflaterInputStream doesn't need more input, it doesn't try to read the end of chunked encoding (0x)(30 0a 0d) that cause the second post to return with -1 every time.
View 3 Replies
View Related
Mar 24, 2009
I am having a specific problem that is preventing me using the android SDK from work. We are using a MS Proxy here that all internet traffic has to go through. The problem seems to be when the emulator is trying to access a site that uses 'Transfer-Encoding: chunked' If I attempt to download www.nds.com (no chunked encoding) into the browser, it works fine. However if I try to go to www.google.com (uses chunked encoding), the browser fails with the message: can't determine content length, and client wants to keep connection opened My feeling (and I'm no expert in this area) is that the underlying code managing the communication through the proxy is not dealing with the null terminator on the chunk encoded response when the connection to the proxy is being kept open? Does anyone have any experience in this area? Is the source to the emulator available so I can try and understand what is going on here?
View 8 Replies
View Related
May 20, 2010
My input is a InputStream which contains an XML document. Encoding used in XML is unknown and it is defined in the first line of XML document.
From this InputStream, I want to have all document in a String.
To do this, I use a BufferedInputStream to mark the beginning of the file and start reading first line. I read this first line to get encoding and then I use an InputStreamReader to generate a String with the correct encoding.
It seems that it is not the best way to achieve this goal because it produces an OutOfMemory error.
Any idea, how to do it ? code...
View 1 Replies
View Related
Aug 26, 2009
I have two text file, both of them contains Chinese characters, one text file is saved using ANSI encoding, but this file's Chinese characters can not be displayed by htmlviewer on the phone. The Chinese characters in another txt file saved using unicode can be displayed ok by htmlviewer. Do you have any suggestions on this, does Chinese characters using ANSI encoding supported?
View 3 Replies
View Related
Aug 9, 2010
I'm trying to rip some DVDs from my collection and get them on my phone for a trip that I will be taking. I just tried to convert one 480x880, 30fps, Constant Bitrate @ 100%, MP4, x264. IDK what went wrong but it wouldn't play from my phone but played fine on my Mac. Does anyone have any suggestions?
View 4 Replies
View Related
Jun 3, 2012
I don't know why but some emails I sent aren't showing properly. If I write something like: "hey, what have you planned for tomorrow"?
It's delivered like this:
=?UTF-8?B?5pS25Yiw5LqM5pak5Zub55uS6ZOB6KeC6Z+z?=
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: base64[code]...
At first I thought it was because of some ROM so I made a clean install of Gingerbread.This didn't fix it so I updated to ICS. Not even changing my written language from Chinese to English worked.
View 7 Replies
View Related
Aug 10, 2010
I'm able to get AC3 5.1 @ 640kbs to work with my 720p mkv files but the playback skips about every 5 seconds. Other then that It looks and sounds amazing! I've tried encoded to 5.1 FLAC and AAC but it doesn't play at all. Are there any encoding experts out there?
View 1 Replies
View Related
Jul 3, 2012
I have LG P970 Optimus black. I know this problem is about a lot of devices and a lot of regions. We are using latin alphabet with some special characters. like "ı, ş, �, ğ, �.." when someone sends me a text message with this characters,
It is normally shown in cm7 and its based roms.
It is normally shown in lg roms which are released for turkey
but it is shown like one space in different lg roms.
For fixing it, what can i do. Is it about message apk? or about some libs?
View 1 Replies
View Related
Apr 23, 2010
It's in the browser settings I have mine on Latin Japanese and unicode are also some other options. I think default is Latin?
View 3 Replies
View Related
Aug 16, 2010
I'm from Portugal and here we have some accentuated letters like "à á é ç ã õ".
When the system language is set to English and we insert one of these letters the SMS limit falls down from 160 charachters to 70 because it changes the encoding of the SMS .
What I would like to know is if it's possible to come with an hack to force the system to encode the SMS in a particular way so these kind of letters don't cut us 90 characters off the message.
Actually this is a problem in a lot of countries. Spain, France, Portugal, Italy, Brazil, Mexico, Argentina and the list goes on... Any country that speeks a latin language really.
PS: I own a Samsung Galaxy S at the moment
View 9 Replies
View Related
Sep 23, 2010
I have two questions regarding video recording on the Droid X.
1. What options are there for encoding? On my HTC Hero I can encode in MPEG4 or H.263. What about the Droid X?
2. My friend sent me a video from her Droid X, but I can't hear anything as far as audio in a normal setting. The only way I can pick up anything she's saying is if I max out the Media volume and hold the speaker directly up to my ear. Is there something she's doing wrong when she's recording the video? This has happened twice now.
View 1 Replies
View Related
Apr 12, 2010
I'm compiling using android tools without eclipse.
I compile launching "ant debug" from command line.
I have found many many instructions around the web about how to remove with annoying warning, but I haven't been able to make any of them work.
I've tried -D option, I've tried randomly tweaking build.* files, I've tried exporting an environment variable... nothing.
I guess some of these methods just don't work, and some others would work but I've been doing them incorrectly. Anything is possible and I can't stand it any more: any advice on how to do it?
View 3 Replies
View Related
Aug 2, 2010
I am trying to set up a ViewFlipper that changes a SlidingDrawers content each time a button is pressed. So far every view I set up worked fine, but now I am trying to create a ListView (including single_choice_mode) within a child view of the ViewFlipper, but my attempt only let to a NullPointerException. As I only discovered ViewFlipper today, I am not yet familiar with it and may not have understood it completely. if someone could give me a hand and help me find out what I have done wrong, that would be great. Here is what I have done:
The code for the onClick event of the ImageButtons:
public void onClick(View v){
if (v == btnExposure){
mFlipper.setDisplayedChild(0); }
else if (v == btnProperties){
mFlipper.setDisplayedChild(1);}
else if (v == btnSpecialEffects){
mFlipper.setDisplayedChild(2);.............
View 1 Replies
View Related
May 25, 2010
I am facing some problems on xml parsing with android. The problem is that the xml from the server comes in "ISO-8859-1" set with setEncoding (I get <?xml version="1.0" encoding="ISO-8859-1"?>) format and the android device seems that its ignoring that encoding. For example this is part of the original xml that comes from the server:
<Result Filename="Pautas para la Present RUP Iteraciones de Construcci.ppt">
<Path>C:Documents and SettingszashaelMy DocumentsPFCRUPPautas para la Presentaci RUP Iteraciones de Construcci.ppt</Path>
<Hostname>computer_1</Hostname>
<IP>192.168.0.5:27960</IP>
<ModDate>01-ene-1601 2:06:34</ModDate>
<Size>33.280 bytes</Size></Result>
And this is what I get on the phone before parsing the xml:
</Result>
<Result Filename="Pautas para la Presentaci RUP Fase Inicio.ppt">
<Path>C:Documents and SettingszashaelMy DocumentsPFCRUPPautas para la Presentaci RUP Fase Inicio.ppt</Path>
<Hostname>computer_1</Hostname>
<IP>192.168.0.5:27960</IP>
<ModDate>01-ene-1601 1:32:06</ModDate>
<Size>26.624 bytes</Size>
</Result>
As you can see there is a problem with the word "presentaci". This is the part of code where I recieve the file, and then send it to the parser:
do { auxMessage = ois.readObject();
if (auxMessage instanceof ComConstants) {
receivedMessage = (ComConstants) auxMessage;
Log.d("Client", "Client has Search Results");
//Charset charset = Charset.forName("ISO-8859-1");
//CharsetDecoder decoder = charset.newDecoder();
//CharsetEncoder encoder = charset.newEncoder();
String test; test = new String(
receivedMessage.fileContent, 0, receivedMessage.okBytes);
if (finalMessage == null) { finalMessage = test;
} else { finalMessage += test;
}
/*try { // Convert a string to ISO-LATIN-1 bytes in a ByteBuffer
// The new ByteBuffer is ready to be read.
ByteBuffer bbuf = encoder.encode(CharBuffer.wrap(finalMessage));
// Convert ISO-LATIN-1 bytes in a ByteBuffer to a character ByteBuffer and then to a string.
// The new ByteBuffer is ready to be read.
CharBuffer cbuf = decoder.decode(bbuf);
String s = cbuf.toString(); finalMessage = s;
} catch (CharacterCodingException e) { }
}*/ } else { Log.d("Client", "Unexpected message " + auxMessage.getClass().getName());
break; } } while (!receivedMessage.lastMessage);
//test encoding
//String s = finalMessage;
//finalMessage = new String(s.getBytes("ISO-8859-1"));
System.out.println("antes de parsear" + finalMessage);
SaxParser sap = new SaxParser(finalMessage);
And this is my parser code:
package citic.android.remoteir;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Iterator;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
public class SaxParser extends DefaultHandler{
@SuppressWarnings("unchecked")
ArrayList myResults;
private String tempVal;
private SearchResult tempResults;
@SuppressWarnings("unchecked")
public SaxParser(String xmlString){
myResults = new ArrayList();
parseDocument(xmlString);
/* In order to test */ printData();
} @SuppressWarnings("unchecked")
public ArrayList getResults(){ return myResults;
} private void parseDocument(String xmlString) {
try { SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setFeature("http://xml.org/sax/features/namespaces",false);
spf.setFeature("http://xml.org/sax/features/namespace-prefixes",true);
SAXParser sp = spf.newSAXParser();
XMLReader xmlReader = sp.getXMLReader();
xmlReader.setContentHandler(this);
StringReader sr = new StringReader(xmlString);
InputSource is = new InputSource(sr);
is.setEncoding("ISO-8859-1");
xmlReader.parse(is);
}catch(SAXException se) { se.printStackTrace();
}catch(ParserConfigurationException pce) {
pce.printStackTrace();
}catch (IOException ie) { ie.printStackTrace();
} }
@SuppressWarnings("unchecked") private void printData(){
System.out.println("No of Results '" + myResults.size() + "'.");
Iterator it = myResults.iterator();
while(it.hasNext()) { System.out.println(((SearchResult) it.next()).toString());
//System.out.println(it.next().toString());
} }
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { tempVal = "";
if(qName.equalsIgnoreCase("Result")) { tempResults = new SearchResult();
tempResults.setName(attributes.getValue("Filename"));
} }
public void characters(char[] ch, int start, int length) throws SAXException {
tempVal = new String(ch,start,length);
} @SuppressWarnings("unchecked")
public void endElement(String uri, String localName, String qName) throws SAXException {
if(qName.equalsIgnoreCase("Result")) { myResults.add(tempResults);
}else if (qName.equalsIgnoreCase("Hostname")) { tempResults.setHostname(tempVal);
}else if (qName.equalsIgnoreCase("IP")) { tempResults.setIpad(tempVal);
}else if (qName.equalsIgnoreCase("Path")) { tempResults.setPath(tempVal);
/*}else if (qName.equalsIgnoreCase("Author")) { tempResults.setHostname(tempVal);
}else if (qName.equalsIgnoreCase("File")) { tempResults.setIpad(tempVal);
*/}else if (qName.equalsIgnoreCase("ModDate")) { tempResults.setModDate(tempVal);
}else if (qName.equalsIgnoreCase("Size")) { tempResults.setSize((tempVal));
} } }
I dont know what to do. I tried setting the string I create after recieving the xml bytes to ISO encoding, but the only thing I got was a "square" instead of " ".
View 1 Replies
View Related
Aug 17, 2010
I want to build my own custom view which should look like the Crysis-GUI.At first I designed a XML-based Layout and made it visible via the setContentView(int resid)-Method. Worked pretty well.But now I wan't to go a step further and draw in my Layout. So I created a new Class, let it extend View and overrode the onDraw()-Method. So far so good.But how can I still use my XML-Layout? I can't do setContentView anymore, so how could the same effect be achieved?
View 1 Replies
View Related
Sep 30, 2009
I have a problem with my DDMS in eclipse. In the logcat view appears only this failure: Logcat View fails with "Could not create the view: For input string: "our" "
I uninstalled and reinstalled the adt and ddms already without any change. I can use the logcat in the command line (tools- adt logcat) but this is not as comfortable as using the logcat in eclipse.
More details of this failure message are:
CODE:...............
View 2 Replies
View Related
Mar 10, 2010
So my layout looks basically like this:
<ScrollView>
<RelativeLayout>
<BunchOfViews/>
<ImageView android:layout_alignParentBottom="true"/>
</RelativeLayout>
</ScrollView>
I have the ScrollView so all of the layout always is visible no matter the height of the screen. The problem is that on a very high screen, I still want my imageview to be at the bottom. However, a child of a ScrollView dont seem to have a defined bottom. The View is placed at the top of the layout. How can I solve this problem in a neat way?
View 4 Replies
View Related
Feb 28, 2010
I like to know how can i clone a view object which is already there in the view hierarchy, so that it can be added to the same view hierarchy again.
View 1 Replies
View Related
Oct 8, 2010
I have an XML layout with some custom tabs, a heading, and a ProgressBar(main.xml). I wish to add another XML layout(home.xml) to the main.xml layout, as i wish to keep main.xml re-usable for other activity's layouts and simply add things to it as necessary.The problem: after inflating R.layout.home into rootLayout, it seems as though the ProgressBar contained in rootLayout is hidden underneath the content of home.xml.Is there a way to tell certain views(via XML) to float above other views when the layout is constructed in this way?if not, am i forced to use methods such as progressBar.bringToFront() to raise targeted views to the top?what alternatives do i have in z-ordering views when some layouts are constructed using inflation?
View 2 Replies
View Related
Aug 18, 2010
I have a WebView inside the ScrollView. The content of WebView dyanamically changes when it displays different html page. I have the following issue: For example I have A.html, and B.html. The content of B.html is larger than A.html, so the page is longer. When WebView load B.html, the ScrollView stretches its size to enable itself scroll for B.html, then if I go back to A.html, ScrollView doesn't resize itself. (The scroll area is exceed the content of A.html) What I want to have, is dynamic change the scroll area of scroll view to fit the webview's content.
View 3 Replies
View Related
Mar 16, 2010
I have a selection for some items using a spinner widget. At the moment the spinner will load a simple Textview and show the name of the item.It is possible to define an own view to show inside the spinner row? I would suspect it being similar to a custom List row.I simply want to show an individual icon left from the spinner text for each item in the list.
View 1 Replies
View Related
Feb 13, 2010
I want to have a View pop in at the bottom of the page exactly like the software keyboard view does in the compose section of the Mms app.It slides in from the bottom, as if it's being added to a vertically oriented LinearLayout, only making the ListView smaller.It becomes a part of the current layout instead of popping up over the top of it.I'd like to to this exact thing with my own custom View.
View 1 Replies
View Related
Sep 17, 2009
I have a problem statement, and here it is: My requirement is: There are a number of images shown on the screen. I want to allow the user to drag and drop any of the images to anyother image. Based on which image is dragged and on which is it dropped, I need to do something specific. So, I need to find a way so that I can get my source view and my target view.To understand this in a better way, consider a practical scenario. In the File Explorer of Windows, we can drag and drop items from the left pane showing the directory tree to any of the folders shown in the right pane.If anyone of you ever faced a similar scenario, please let me know because I could not find a direct support to such a thing (Drag and Drop) in the platform, so may be I need to find an innovative solution to it.
View 4 Replies
View Related
Sep 30, 2009
something weird is happening when i inflate a particular view and i wonder whether i'm running into some kind of namespace collision inside the resource/class space.i have a few custom views in my app and generally i park them in discrete XML files. the views are declared.
View 3 Replies
View Related