Special characters in JSon of Webservice
My application from a json object a webservice. After the analysis of the json object I find characters of strings you have coded something because, rather than get the string what frio! Aguero, paraguas, nunez y Belén. I get the Quebec is Warf chain! AGA¼ERO, Paraga¼as, Nua±ez y Bela © n.
How can I solve this problem? How can I get the correct characters in the string?
Replace this:
if(ResponseCode == HttpConnection.HTTP_OK) {}
InputStream in = connection.openInputStream ();
StringBuffer buf = new StringBuffer();
int read = - 1;
While ((read = in.read ())! = - 1).
buf. Append ((Char) Read);
response = buf.toString ();
response = new String (read, "UTF - 8");
}
with the following (this is from memory, so probably has a syntax error - but you get the idea):
if(ResponseCode == HttpConnection.HTTP_OK) {}
InputStream in = connection.openInputStream ();
Byte [] read is (in) IOUtilities.streamToBytes;.
response = new String (read, "UTF - 8");
}
Tags: BlackBerry Developers
Similar Questions
-
Special characters of POST - JSON - XHR
Hello.
I tried to send the JSON data via XHR POST. The XHR POST, I put a setRequestHeader as follows:
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
By default, this should work and it works, but if sending a chained JSON string as for example. What follows that it does not really:
xhr.send("data="+ JSON.stringify({"testData": "123", "msg": "&&&&"}));
Using the "&" rewritten and send in this way:
{"testData":"123","msg":" : : : "}
I also tried to use this request header:
xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8");
but because of CORS this does not have to serve.
All that I'm missing? I also tried with other values and special characters and the '&' is the problem here.
I got it working now with the following source has changed:
xhr.send("data="+ encodeURIComponent(JSON.stringify({"testData": "123", "msg": "&&&&"})));
For now it seems to work. I hope that that doesn't happen any other matter?
-
JSON format - Date and special characters
Hi all
I had a JSON server in which, I have a few text values and date.
- How can I convert special characters to normal String.e.g. Comma etc. ?
- How can I convert long date, a string in the format e.g. "1345670466960-0400"?
I really appreciate any help above.
Solved... Where the above closure. For others, I will post the solution.
Special characters-
QByteArray buffer(bufSize, 0); int read = reply->read(buffer.data(), available); //response = QString(buffer); -- Wrong way to convert the bytes. response = QString::fromUtf8(buffer); // right way, so special character handled itself.
Day fromatting - for example "/ Date (1345670466960-0400).
QString getStringDate(QString k){ QDateTime date = QDateTime::fromTime_t(getDate(k)); QString strDate = date.toString("MM/dd/yyyy HH:mm:ss"); return strDate; } long getDate(QString k) { long rc = 0; QString v = k; if (v.length() > 0 ) { int b = v.indexOf("/Date("); if (b >= 0) { b += 6; int e = v.indexOf(')', b); if (e > b) { QString s = v.mid(b, e); int sign = 1; if (s.indexOf('-') > 0 || s.indexOf('+') > 0) { sign = s.indexOf('-') > 0 ? -1 : 1; e = sign < 0 ? s.indexOf('-') : s.indexOf('+'); s = s.mid(0, e); } bool *ok = false; s = s.mid(0, s.length() - 3); //trimming it for seconds only.... rc = s.toLong(ok, 0); } } } return rc; }
-
How to insert special characters when I hit e-mail or Facebook?
How to insert special characters when I hit e-mail or Facebook?
See also:
-
whenever I press the SHIFT key, the web development Toolbox opens. I am unable to use the letter upercase, special characters and everything that requires the SHIFT key. It's really annoying me... i can't even use an exclamation mark111111
The sounds you have a sticky key which is in the pressed state.
Do you mean the box tools that should open via Ctrl + Shift + K or open more to the Toolbox that is displayed via Ctrl + F2?
Try to press the keys involved several times, see the Web Developer menu for the shortcut keys.
Have you tried to close and restart Firefox or restart the computer?
-
Where to find and install special characters in Firefox?
Where to find and install special characters sets (French, German and Spanish) in my Firefox with Dutch language?
TIA
JoepTranslation:
TOOLS = > Options = > content = > languages = > click "Select" and then "select a language to add."
For the character encoding:
TOOLS = > Options = > content = > fonts and colors = > advanced (button) = > character encoding
-
Not a problem/w Firefox - I was wondering if there is a way to enter the special characters and characters (not on the keyboard) in the text boxes? I remember that there is a keyboard sequence that activates a context menu allowing the single character/symbol entry. Thanks in advance, Allan.
See:
-
Special characters: Angle symbol
Hi, I am trying to find the symbol 'angle' commonly used in mathematics (two lines forming an angle of 45 degrees, an acute 'L')
The answer previous (linked) says to do the following
-Edit
-Special characters
-Math (etc.)
However, this is an old post and now this option seems unavailable.
Seems to be replaced by 'Emoji and symbols' However the closest I can find in this list is "⎳".
I sincerely hope that I have not only lack. Thank you
Execution of Yosemite 10.10.3
angle geometry symbol, can it be typed? Which character keyboard or the police?
Emoji & symbols is just a new name for special characters.
Did you click on the toothed wheel and customize and add mathematical symbols? I see ∠ to U + 2220.
-
Problem of L50 - B satellite with special characters in country
I recently bought the laptop SATELLITE L50 - B - 17 c and have a problem with special characters from countries in windows 7.
In Polish, key key programmer combination right alt and the keys 'z', 'x', and 'c' should give the Polish special characters.
Unfortunately this does not work for these three keys, however works other keys in Polish characters as 'l', 'n', 'a', a ' or 'e '. I suspect that this may be linked to the special key Fn,.
However turning or disable in the BIOS did not help. Maybe there should be a driver of special keyboard for windows 7, but I have not found it :(
{quote} I recently bought the laptop SATELLITE L50 - B - 17 c and have a problem with special characters from countries in windows 7. {quote}
The laptop has been presintalled and configured with the Win 8.1 System.
Have you noticed this problem with installation of Win 7 8.1 or after the victory?If you have an external USB keyboard, I recommend you to check if the same problem would appear using the USB keyboard. In case the external USB keyboard would work correctly, the problem could be related to a defective internal keyboard
-
Potential problem of keyboard - special characters
Hello!
I recently encountered a problem, and it is reproducible. When you type in Chrome on my Macbook Pro 13 inch Yosemite running, if I try to type a special character (for example, an 'e' with an accent), the keyboard becomes unresponsive. If I refresh the page, it still fails. The only way to make sensitive again is to close the browser and reopen it, but that does not make special characters work. Any ideas? I'm under 47.0.2526.111 (64 - bit) Chrome Version, if this is useful. Thank you!
You have this problem with any app Apple, such as Safari, Mail, TextEdit, Pages, messages, Notes?
-
Special characters in the password
Hi, I have chosen a password with caracter special: now @!
and then, it is impossible to type the character @, so I can't start my machine!
What can I do?Hello
Sorry, but now you have a big problem. For the BIOS password or supervisor password, it should be used only the following characters: a... z, a.. Z and 0... 9 paperChoice of some special characters will cause that the laptop not boot not. In this case, contact your authorized Toshiba Service Provider because the password must be deleted and there is no way you can do it yourself.
-
Special characters and accents on the smart keyboard?
How to type special characters and accents on the smart Pro iPad keyboard? For example, I like to write "Róisín Murphy" with accents in the name as shown here. But I can't find a way to do it. Are there not as a software keyboard that I can draw on screen for those?
Thank you.
If you have your English keyboard, then you can use the standard Mac shortcuts. For acute, you more e option, then the basic letter. e is more e, then e option.
If you have your keyboard to something else, like Italian, then it might be different. That your keyboard is set to?
-
where are the special characters in the new Pages?
where are the special characters in the new Pages?
Menubar pages: Edit: Emoji & symbols, or control-command + space combination. Same situation in other Apple applications. In addition, available as a menu item from the menu entry in the menu bar to the right, Finder.
-
How to avoid special characters in a string
Hai.
I want only Alphabets & numbers to appear on my channel. No other special characters except spaces. How can I do this?
Hi Alice,.
See the attached example.
It will be useful.
Mike
-
Linkd.exe works do not with special characters
Hello, I want to use linkd.exe to the Windows on Windows Server 2003 Resource Kit. It works fine, as long as there are no special characters in folder names. But if there are special characters, it displays: "cannot create a link to: ' and it creates a new folder with another special character instead of the one in the name of the source folder.
for example "linkd Folder2 Folder1§" does not work and creates a new folder named "Folder1".
I tried several code pages.
Hello
Transfer your question in forum Windows Server
http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?Forum=winservergen
Maybe you are looking for
-
iPad Pro 9.3.2 iOS installation problem
is there a way to delete the download 9.3.2 and start again without removing everything from the iPad
-
Tecra M1: under XP Bios Update does not work!
Hello When I try to update the bios on my tecra M1, it does not work and stops with a popup that displays the following message: Upgrading the Bios[Error] User is not authorized to update BIOS. I use windows xp family with administrator permissions h
-
Satellite P30-143 - need memory to increase the RAM
Hello I need some memory for my Toshiba laptop, it's a Satellite P30 - 143 (PSP30E-21301GS4) PC2700s DDR333MHZ CL2.5I want RAM Kingston, but I can't find on the site kingstonmemory. And I do not know the maximum that I can use. No idea? Thank youJoha
-
How to obtain an overview of the thumnbails images
How can I preview images in the image stored in my pictures folder
-
Want the default large icons to display the files when I open a folder