Problem with encoded UTF8 parameter when calling request.getParameterValues
I'm losing some parts of my parameters when I get to the servlet.
Using the java.net.URLEncoder on an English/Chinese UTF-8 string combination, I created a URL with a parameter "pk". I use this in an HTML page that calls a servlet. Here is what I set the parameter equal to:
pk=GUEST.%E6%88%3F%E9%83%BD%E8%88%B9%E5%3F%95%E4%BD%3F%E8%A7%84%E6%A0%BC
My URL looks like the following:
http://localhost/servlets/MyServlet?pk=GUEST.%E6%88%3F%E9%83%BD%E8%88%B9%E5%3F%95%E4%BD%3F%E8%A7%84%E6%A0%BC
When this gets to the servlet side, I lose all of the chinese parts of the String when I call request.getParameterValues("pk") for this string. This is the case even if I convert the string to UTF8 using getBytes("UTF8").
String[] pks = request.getParameterValues("pk");
pks.length = 1
pks[0].length() = 6
pk[0]=GUEST.
Any clue why?
My page has a charset of utf-8 and other pages with using posts work fine. Unfortunately my request must be a get in this situation.
Try this standard tomcat workaround...
String[] tmppks = request.getParameterValues("pk");
String [] pks = new String[tmppks.length];
for(int i=0; i<tmppks.length; i++)
pks[i] = new String(tmppks.getBytes("ISO-8859-1"),
), "UTF-8");Hi,
I am working in JSP.
If I don't convert the string to UTF-8 format, then even though I am setting the charset to UTF-8 in jsp page, it is not giving the correct parameter values.
Is there any way other than converting the string from "ISO-8859-1" to "UTF-8", in order to get the string in UTF-8 format i.e., to get string in UTF-8 format directly from request.getParameter method?
Thanks & Regards,
Kavitha.
Similar Messages
-
Problems with SKIP FIRST Screen when calling a transaction variant
Hi,
I have a transaction variant of VA02 that suppresses the display of the pricing button on the conditions screen. I have created a variant transaction for called ZA02 which calls this variant of VA02.
In my program I have coded the following :-
SET PARAMETER ID 'AUN' FIELD VBELN.
SET PARAMETER ID 'VPO' FIELD POSNR.
CALL TRANSACTION 'ZA02' AND SKIP FIRST SCREEN.
I would have expected the program to display the second screen of VA02 but it displays the first screen and when I hit return key the second screen is then displayed.
I don't think I need VPO setting but when I code
SET PARAMETER ID 'AUN' FIELD VBELN.
SET PARAMETER ID 'VPO' FIELD POSNR.
CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
VA02's second screen is displayed
Any help as to how to Skip this first screen with ZA02 would be greatly appreciated
Thanks
RousYes you are right Reg thanks for that.
But it appears that VA02 doesn't require it setting anyway. I changed the PID to APO and indeed I've even commented the line out, but my program goes to the second screen when calling VA02 but stays on the first screen when calling ZA02 . -
The problem by hearing my voice when calling from iMAC
I use the latest version of OS X and iOS on all my devices (OS X and iOS 8.1.1 10.10.1). The receiving calls through iPhone 5 have a problem with hearing my voice when calling from iMAC. When make incoming, but also outgoing call through iPhone5 on my iMac, I can hear the caller, but he can not hear me, although tilde see sound when I speak to your iMac.
When the call using my iMac I can hear the caller, but he's not me.
MacBook Air while everything works smoothly, there hear me. You do not know me with this please help?
ThanksYes, my microphone works correctly, f.e. skype, record spund for my videos... no problem with microphone on my iMAC
-
Just recently, I have encountered a problem with my iPhone. When someone calls, I can clearly hear the caller, but the caller cannot hear me speak. Sometimes the problem is nt there and works properly, but most of the times, I am facing this problem. I have tried plugging in the earphone and speak, but its the same.... can anyone advse what may be the problem?
iphone 4g have this problem
first solution :change the flex micro
second solution : ic audio must reballed
also watch video
http://www.youtube.com/watch?v=C-n1LJEK3PM
http://www.youtube.com/watch?v=prSZ9yJnofY
http://www.youtube.com/watch?v=tkEiR6OPhhc -
I have problem with my Iphone 5, when I talk my ear allways tuch the screen and get it on no sound, the screen are not lock, is ti possible to lock the screen when incomming an outgoing call going on
Hello Mogulman46,
So what that means is when you have Do Not Disturb turned on, you may have an alert depending on the setting and how you are using your iPhone. So if it is set to Always, then that means that no matter what, your iPhone will not be notified. If it set to Only while the iPhone is locked, then that means that you will not get notification when your iPhone is locked but you will get notifications if your iPhone is being used. Also keep in mind the settings All Calls From can be set to certain contacts like Favorites, Everyone or no one. If you are using Do Not Disturb and you do not need it, then turn it off.
Use Do Not Disturb on your iPhone, iPad, or iPod touch
http://support.apple.com/kb/ht5463
Regards,
-Norm G. -
When I turn my computer on (Windows 7) I receive a message that Apple wants to make a change to the hardware. I click on yes but nothing happens. The change has something to do with Apple "push". I recently had a problem with"push" on iTunes when I tried to sync my iPod Touch. I have latest software for iTunes and iPod. Can anyone tell me what to do to get this change to install?
ptford wrote:
When I turn my computer on (Windows 7) I receive a message that Apple wants to make a change to the hardware
Since hardware cannot be changed with software, perhaps you would be so kind as to post the exact wording of the message? -
i have some problem with my computer because when i turn it up, the screen turns in a blue colour and the sound doesn't work and in this way i can't hear anything
Will u help me or not?
-
I have Windows 7 and just recently experienced a problem with itunes freezing up when I clicked on the "apps" tab which shows the apps that are loaded on my phone. Everything else in the itunes software seems to be working okay. The problem is in the part where you sync the newly purchased apps. The apps will all be blank that are downloaded and that part of the software crashes itunes or freezes up. I can get out of itunes okay after the freeze up, but it just stops me from syncing anything that I have newly added. If anyone has had this problem before or knows someone that has, please let me know how I can fix it. I have uninstalled and reloaded itunes 4 or 5 times, but the problem is still there. I might add that I have been using itunes and purchasing apps for 2 to 3 years without any problems. HELP.
You would get better response from the iTunes community forum.
Have a nice day! -
I have a problem with two PDF's when trying to open them through a link on a web page. The two PDF's open fine with Adobe on my own PC and on the server I have copied it to but when they are opened through a link on a web page (pointing to the server where the PDFs open fine) I get an error 'There was an error processing a page. Invalid function resource' The other one just doesn't open at all. Can anyone help with this please?
Hello,
Are the pdf linked correctly in the website? Is this a public website? If yes, please post the link here.
~Deepak -
Ive used compressor and then tried to put it in dvdsp put its not working. I am having problems with the audio or when i burn it , i cant play the dvd? any help would be appreciated
I suspect you are attempting to burn an HD DVD, which will not play on a DVD player...
But if you provide more details such as the settings you are applying in Compressor, then we would be able to provide you more accurate information.
How are you adding the files to Compressor?
In FCP, what are your footage properties (command-9) and sequence settings (command-0) -
Anyone having problems with Elements organiser 13 when try to import photos from Mac photos which was an upgrade from Iphotos on 9th April 2015. Before when I was using Iphotos all was ok...
hi I have been trying to do this, but PE13 comes up with a fail message saying that file types are not supported, am only trying to import jpeg files so can't understand this. So far have been unable to use PE13 at all, any ideas anyone please!
-
Im have a problem with my adobe id when i try to covert pdf files.
Im have a problem with my adobe id when i try to covert pdf files.
I think your question should go in the ExportPDF forum,
http://forums.adobe.com/community/exportpdf -
Hello I have encounted a problem with Photoshop. Normally when you start a new documant, you are given the options to have A4, A3, ect page set ups. These inbuilt page set ups seem to have disapeared, does anyone please know how to fix this? Many thanks Ben [email protected]
Hello Trevor
Thanks for your message. You can custom set pages but there are no preset of page sizes like A4, A3, ect. I cannot click the size preference, nothing comes up
Ben -
hi, i have problem with my apple id when i want purchase app even free one, asked me for complete my card informations... but i don't want to use debit card because already i have gift card and charge it in my id... please help me.
when i unchek the card information it was show me an error!Though you are being asked for card details it doesn't necessarily mean that the card will be charged for the purchase (unless you want to gift content). Have you tried entering your card's details to confirm the account ? You should then be able to remove it.
From http://support.apple.com/kb/HT5582 :
When making purchases, content credits are used first, followed by Gift Certificate, iTunes Card, or Allowance Account credits; your credit card or PayPal account is then charged for any remaining balance
Is it a new account ? If it is then unless a new account is created by following the instructions on this page (the instructions won't work with existing accounts) : http://support.apple.com/kb/HT2534
then you will need to enter card details (debit cards are no longer accepted in all countries) before the account can be used to download any item from the store. -
I have a problem with elements 8. When ever I start a new project, the program searches for the old, latest used filmmaterial, I have used before. That means, if I use a different DVD, it take so much time, until the program starts. So how can I stopp the automatically uploading of old material?
ThanksYou have 2 unreachable statements in this method.
public static int eval(String s2, String op, String s3) {
return lookup(s2);
return lookup(op);
return lookup(s3);
} You're missing a } at the end of this method:
public static int lookup(String s) {
for(int k = 0; k < symbols.length; k++){
String symbol = symbols[k];
if(s.equals(symbol))
return k;
}You have some loose } and ; at the end of the file:
public static void main(String args[])
commandline();
}
Maybe you are looking for
-
Instead of Update Trigger error
Hi all, I've been trying to solve this issue from past 4 to 5 days..I am unable to solve...Can someone please help.... I hhave a requirement in which I need to update 4 tables from a single form...I created a view which will get the required fields a
-
Microsoft for Mac documents are not compatible with PC versions
THIS IS DRIVING ME UP THE WALL PLEASE HELP!!! I love Apple computers, but I may not be able to get one for my next laptop because of compatibility problems with Microsoft for Mac. Whenever I work on something for school on my Mac using word or PowerP
-
I can not even get onto Verizon Chat to obtain help. We are out of service due to storms and would like an ETA of services being restored. The closest city would be Chico
-
Does anyone know if there is a way to open and edit a SWF file.
-
Ho aggiornato il sistema operativo da Windows 8 Pro 64 bit a Windows 8.1 Pro. Adobe Bridge non ha più funzionato correttamente. L'area di lavoro si modifica e si espande anche sul secondo monitor. Ho disinstallato, resettato e reinstallato tutta la S