Answered by:
Server returned HTTP response code: 400 for URL:

Question
-
Server returned HTTP response code: 400 for URL: http://moss-2010-demo/Lists/EMPLIST/Attachments/13/हिन्दी.txt
- Edited by MSDN Forum's Profile Monday, October 17, 2011 7:12 AM
Monday, October 17, 2011 7:11 AM
Answers
-
Hi Priti,
Could you please encode the "हिन्दी" in the URL, and check if it works?
The new URL should be like: http://moss-2010/Lists/EMPLIST/Attachments/13/%e0%a4%b9%e0%a4%bf%e0%a4%a8%e0%a5%8d%e0%a4%a6%e0%a5%80.txtI am not familiar with Java, but it seems in Java, you can use the following code to encode the URL:
"http://moss-2010/Lists/EMPLIST/Attachments/13/" + URIUtil.encodePath("हिन्दी.txt", "ISO-8859-1")Thanks,
Jinchun Chen
Jinchun Chen
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff AT microsoft.com(Please replace AT with @)- Proposed as answer by Thilosh V N Monday, October 31, 2011 9:00 AM
- Marked as answer by Emir Liu Tuesday, November 1, 2011 5:31 AM
Wednesday, October 19, 2011 10:52 AM
All replies
-
Are u trying to access the attachment with the above Url ??? Guess the attachments is not present in the site .
Monday, October 17, 2011 7:28 AM -
I have already seen this in SharePoint but it actually comes from IIS. IN my case it was a file in a library and the file had a forbidden character in the filename. You can see it in the library but when downloading the file, we got HTTP 400. Try putting the file directly in the library and you should see the same thing.
To correct this, I remember it was a web.config change to allow special characters of some type. Look here for more information http://serverfault.com/questions/257680/properly-handle-iis-request-with-percent-sign-in-url.
Florin DUCA
MCITP Enterprise Admin, MCSE 2003 +Sec, MCITP/MCPD SP 2010, MCTS conf/dev WSS3/MOSS, MCPD ASP.Net 3.5, MCTS ISA 2006
Logica Business Consulting, FranceMonday, October 17, 2011 7:53 AM -
Yes, I am trying to access attachment with same URL http://moss-2010-demo/Lists/EMPLIST/Attachments/13/हिन्दी.txt
But in my java code at below it is throwing the above exception!!! Attachment is already exist on my sharepoint server
java.io.BufferedReader br =
new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream("C:\\हिन्दी.txt"),"UTF-16"));What should do?
- Edited by MSDN Forum's Profile Monday, October 17, 2011 8:11 AM
Monday, October 17, 2011 8:07 AM -
Hi Florin,
Can you please give me the solution while accessing text file at Url
http://moss-2010-demo/Lists/EMPLIST/Attachments/13/हिन्दी.txt
Where is the actual problem?
Monday, October 17, 2011 8:14 AM -
I am not a java export but if reading the file from the c:\ (it's what i see in you code sample) fails, then it might not be a SharePoint/IIS issue. Can you download the attachement with the SharePoint UI (from the SharePoint site)?
Florin DUCA
MCITP Enterprise Admin, MCSE 2003 +Sec, MCITP/MCPD SP 2010, MCTS conf/dev WSS3/MOSS, MCPD ASP.Net 3.5, MCTS ISA 2006
Logica Business Consulting, FranceMonday, October 17, 2011 8:19 AM -
I have not downloaded the attachment on my local PC but I can open attachment in browser through sharepoint web site.It is opening properly.
I am doing as follows.
Hi,
In this case attachmentUrl is "http://moss-2010/Lists/EMPLIST/Attachments/13/हिन्दी.txt"
InputStream is =null;
try {
attachmentURL = attachmentURL.replaceAll(" ", "%20");
URL u=newURL(attachmentURL);
is = u.openStream();
}
Here at line is = u.openStream(); it is throwing an exception SharePointException: getListItems (Exception): null
Other test files in the same URL "http://moss-2010/Lists/EMPLIST/Attachments/13/ora.txt" are opening properly except this unicode text file
File contents are:(हिन्दी.txt)
हिन्दी,Hindi
తెలుగు ,Tamil
मराठी,Marathi
પસંદગી,Gujarati
পছন্দসমূহ,Bengali
העדפות,Hibrew
മു൯ഗണനകള്, MalyalmPlease help!!!!
- Edited by MSDN Forum's Profile Monday, October 17, 2011 8:30 AM
Monday, October 17, 2011 8:29 AM -
Hi Priti,
Could you please encode the "हिन्दी" in the URL, and check if it works?
The new URL should be like: http://moss-2010/Lists/EMPLIST/Attachments/13/%e0%a4%b9%e0%a4%bf%e0%a4%a8%e0%a5%8d%e0%a4%a6%e0%a5%80.txtI am not familiar with Java, but it seems in Java, you can use the following code to encode the URL:
"http://moss-2010/Lists/EMPLIST/Attachments/13/" + URIUtil.encodePath("हिन्दी.txt", "ISO-8859-1")Thanks,
Jinchun Chen
Jinchun Chen
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff AT microsoft.com(Please replace AT with @)- Proposed as answer by Thilosh V N Monday, October 31, 2011 9:00 AM
- Marked as answer by Emir Liu Tuesday, November 1, 2011 5:31 AM
Wednesday, October 19, 2011 10:52 AM -
Hi Jinchun,
Yes. It worked and finally I got the solution.
I did: "http://moss-2010/Lists/EMPLIST/Attachments/13/" + URLEncoder.encode(हिन्दी.txt", "UTF-8"));
Thanks a lot.
Thursday, November 3, 2011 5:11 AM