dealing with the URL/URI field encodings

I'm the pages of a Japanese website and then download by saving to files. Sometimes after a request, a page without relevant content is returned. My guess is that the requested URL is not coded correctly.
Sometimes, the requested page is returned without any problem. According to the api URL:
"... The URL class does not itself encode or decode URL components according to the exhaust system defined in RFC2396. It is the responsibility of the caller to encode all of the fields, which need to be escaped before call to URL and also to decode all the fields escaped, who returned from URL. ..."
I tried to follow these guidelines:
-----
String asianChar = _; <-a Chinese character
String s = "http://www.acme.co.jp/dsearch?p=" + asianChar + "& stype = 0 & dtype = 0";
UriRef URI = new Uri;
URL urlRef = uriRef.toURL ();
HttpURLConnection conn = () (HttpURLConnection) url.openConnection;

SFD CharsetDecoder = Charset.forName("UTF-8").newDecoder ();
List < String > pagedump = new ArrayList < String > ();
BufferedReader bufrdr = new BufferedReader (new InputStreamReader (conn.getInputStream (), SFD));
While (true) {}
String line = bufrdr.readLine ();
if(Line == null) break;
pagedump. Add (Line);
}
...
dump 'pagedump' to the txt file encoding "UTF - 8", opened with "notepad.exe", sometimes the requested content is there, sometimes not.
-----
These contradictory results have stuck to me.

Running this program within Eclipse still seem to work. But this cannot be the solution. I have to run this a typo: "C:\HOME\java-jar program.jar".

because the bad character is in the query string, a fake url probably will not cause a 404 error. What do you think is impossible allows to encode that character before inserting it into the url string.

Tags: Java

Similar Questions

  • By the way the dynamic parameter with the URL while submitting the form

    Hello

    I the data in xml format in a servlet using the button send the form. I also need to pass a parameter with the URL. But the value of this parameter changes during execution based on the value of a particular field in the form. Please help me with it.

    Thank you.

    Here is an example that shows what I think you want. The code is on epreSubmit th of the button event. I put messages showing what the button submit it URL is... before and after we change. You can delete these messages when make you it work as you want.

    Hope that helps

    Paul

  • I forgot my password for apple and have permission to stage the 2 and broken my old phone and do not have the same number of what I can do my account is already waiting to be reset, but it takes apple long to to deal with the what else is there to do?

    I forgot my password for apple and have permission to stage the 2 and broken my old phone and do not have the same number of what I can do my account is already waiting to be reset, but it takes apple long to to deal with the what else is there to do?

    You know the e-mail password what do you use? I lost over $ 30 on my old Apple ID because I couldn't get into the email and apple would not transfer my money to my new account.

  • ITunes has stolen my music from my computer. Because they do not want to deal with the public, what should I do to get back them.

    Every so often, iTunes sends a notice to update the iTunes on my computer. Last year after that they did, all sounds have disappeared from my list of reading hundreds of old songs. Now, when I click on any song or melody, nothing happens.

    Given that Apple does not want to deal with the public, I ask, what do I do now, please?

    See the empty/corrupted after upgrade/crash iTunes library. Ideally, the measures taken immediately after that the problem appeared would restore your library. In some cases your media may be still on the computer, but not when iTunes is looking to it. The songs that do not play show with an exclamation point in the view of songs? ITunes plays all audio signal at all?

    TT2

  • Dealing with the size of the stage and the different orientations

    I am clearly dense, but I'm looking for examples of how others deal with the need to have apps that funciton in mode landscape or portrait.

    My first effort simply uses a scene from 600 x 600 with automatically guide the true value. It seems to work OK. The app draws, in the center of the screen of the Playbook (Simulator), regardless of the way the screen is oriented. Waste certain properties of the screen, but for my purposes, it doesn't really matter.

    To try to make it easier to deal with some questions I had try to implement new, I tried to make a step in 1024 x 600 with my stuff centered in space. Works very well in the landscape, but when in portrait mode, the app has been reduced to 1024 to the 600 dimension tree. I turned on Noscale for the scene, and now the app is drawn with the scene at the upper left corner then the app is cut on the right side of the screen. Is there a way to make the center of the scene?

    For my next one, I'll probably need to have two settings screen which are used based on direction - guidance on which is easier to deal with?

    I just wanted to mention that I removed the rotation and repositioning of the scene in the event onOrientationChange because I'm sure it was bad and can't remember why I had done this.

    Also, I recommend the mobile controls around on stage resize because when changing the orientation event is called, stage.stageWidth and stage.stageHeight properties have not yet been updated.

    The only uses for the orientation change event that come to mind anime the passage of an orientation towards another and the reorientation of handling maually when you autoOrients set to false.

  • Image processor "sorry, I could not deal with the following... * all."

    Hey! I so about 150 files opened in Photoshop. They are for a customer and the customer wanted individually to certain effects on each file. The files are RAW initially, first imported in Lightroom as .dng, then all my tonal changes made in Lightroom. I then opened images as smart objects in Photoshop, with a script of Lightroom. I then did the individual work on each image in Photoshop on the assumption that it would not trouble to save using the Image Processor script. When it came time to save, I tried save as .tif files using Image Processor. I selected the target in the form of open files files, set my destination folder, chose the TIF format and click on run in the top of the window. He shortly after said one very fast without source images, which disappears and then he says: "Sorry, I couldn't deal with the following" and then lists all of the 150 open pictures. It is a big problem because I'm on a lack of time.

    Any help or another idea for how to register all these images open in TIF or PSD even at this stage is extremely appreciated. I think there must be a fix or other road opposite to old fashion one save under...

    Thank you!

    !

    It doesn't look like the IPP will not new document either.

    He can. I added an option that can be set in the script to take care of this problem.

    //

    PROCESS_UNSAVED_IMAGES

    This will allow the treatment of unsaved images. To make this work,

    an unregistered image file is ~ / Desktop. If a file extension is

    not in the name of the image, .psd is used.

    //

    ImageProcessorOptions.PROCESS_UNSAVED_IMAGES = true;

    By default, it is false to get the 'traditional' behavior Set to true will leave PPI to process new images, not registered.

  • Hidden field in form with the url of the page value

    Hello world of Dreamweaver,

    Just a quick question im stuck on.

    I have created a simple form name, Email and Message. The problem is I want to use the same form on several different pages, but being able to say what the URL of the form was sent from. I see I want a hidden field in the form, but how could I go all that actually send the URL with the other information?

    Thanks in advance!

    Do better on the server side (ColdFusion, ASP, PHP, etc.).   In ColdFusion, you can use #cgi.script_name # to get the name of the document that contains the form.

    However, you can use JavaScript (not as reliable - esp if the user has JS disabled.)

    Location.href or document. URL will take the path of COMPLETE domain including the name of the document.  Don't forget to access the page via the domain name FULL or http://localhost or http://127.0.0.1.  If access you it via file:\\\C:\path\to\document.htm, so I don't know how this will work.

    ^_^

  • Dealing with a URL parameter to be used for a default value

    I have a page of results of detail (the CONTACTS Table Recordset), identified by the CONTACTID

    In the same page, I also have another dynamic relational table, showing all the associated notes that contact record (recordset CONTACTNOTES identified using CONTACTS. CONTACTID = CONTACTNOTES. NOTESCONTACTID)

    It works fine and I can update CONTACTS without any problem.

    My problem is to insert a new record CONTACTNOTES (of a simple URL link) also associated with the same record.

    The primary field (NOTEID) is an AutoNumber but I need to carry out CONTACTS. CONTACTID variable to use as the default value for the CONTACTNOTES url. NOTESCONTACTID.

    I think something like that...

    in the dynamic table on the initial results page, using (/ insertnote.php?) CONTACTID = <? PHP echo $row_recordlookup ["NOTESCONTACTID"];? >) as the link, setting the URL parameter.

    The page insertnote has a recordset insert form, related to the CONTACTNOTES table.

    Now, I don't know how to add this URL parameter as the default field value. Is it as simple as putting the $HTTP_GET_VARS ["CONTACTID"] in the field of the Init val in the property inspector?

    Sorry - worked on...

    On the new page of note insertion, I first created a Recordset, duplicate on the initial results page.

    When you create the form, it was easy then to insert {CONTACTS. CONTACTID} as a default value.

  • the best way to deal with the changed values maskMode?

    Hi people

    I just found out that the values listed for maskModes have changed between CC14 and CC15 who broke most of my scripts of masking.

    IE MaskMode.ADD in CC14 has the value 6413 but CC15 is 6813.

    What is the best way to deal with this? is there a simple solution or what I need to check the version of AE which is used and adjust from there?

    is there a direct way to access the name ie "MaskMode.ADD" instead of the value?

    Thanks... /JL

    To get the string maskMode by the current mask, you can loop through all the values possible maskmodes and stop when you click on:

    for (var k in MaskMode){
        if (myMask.maskMode === MaskMode[k]) break;
        };
    // at this stage k is the maskMode string (eg: "ADD")
    

    Xavier

  • Dealing with the lower ASCII characters

    In my database, somehow there are strange lower ASCII characters in some areas. It doesn't happen often, but I have some problems. For example, I found a field with an ASCII 12 x (18 decimal) character, which is something called "Device Control 2. When I run a query like

    SET SERVEROUTPUT ON SIZE unlimited

    SELECT

    p.TX as "TX".

    Of

    point p

    WHERE

    para_id = 22623526 / / contains a bad character

    Get different results depending on whether I have run into a TOAD with F5 or F9. F9 returns the line after line, but it puts a box where the bad character is

    http://Pelorus.org/pictures/ToadAsciiError.PNG

    But, if I run it with F5, I get nothing.

    1 selected line. < < the single output possible.

    If I change the para_id to something else, I get perfectly good output with F5

    TX

    --------------------------------------------------------------------------------

    Milestones begin and end listed in Appendix-a. dates will be used for guidan

    for all the work performed by this request for maintenance.

    1 selected line.

    And even weirder, if I have the coil in a file, I get the data, but has the wrong character.

    TX

    --------------------------------------------------------------------------------

    Tighten each anode zinc new foot nut # 30lb of restraint. [CFR-465]

    1 selected line.

    (Mark hash added by me, but I can see the ASCII (x 12) in a hex editor.)

    Here is a link to the text file with the wrong character

    http://Pelorus.org/pictures/Err.txt

    My questions are

    1. What's happening here?

    2. How can I strip this character on? I export it as an xml file, and this character causes me problems.

    3. I see other bad characters in a few other places. Namely ASCII 13 x (19 dec) and ASCII 1Dx (29 dec). I hope that the solution to remove easily extrapolate other unwanted characters.

    4. ideas how something like that you here in the first place? Cosmic rays?

    I tried to use ASCIISTR() to delete, but it did not work.

    ASCIISTR (p.TX) AS "TX".

    The bad characters are still there.

    Server Info:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    PL/SQL Release 11.2.0.2.0 - Production

    CORE Production 11.2.0.2.0

    AMT for Linux: Version 11.2.0.2.0 - Production

    NLSRTL Version 11.2.0.2.0 - Production

    You can use the function to translate to remove unwanted characters from your data:

    with t as)

    Select 'ab '. Chr (18) | 'cd' union tx double all the

    Select 'ab '. Chr (19) | 'cd' double tx

    )

    Select translate (tx, 'a' | chr (18): chr (19), 'a') t

  • How to deal with the change in scope

    Dear,

    No org by enforcement period. Consolidation of the CDA. CDA entry.

    September, a company (X) is thrown into a perimeter (a-frame) and granted in a different consolidation perimeter (part B).

    I need perform the following acts:

    (A) CDA profit & loss of X, from September, must contribute to A scope results until December;

    (B) BAT profits/losses of X in September, October and December, must contribute to the results of scope B until December.

    (Operations under A) and B) can be automated? No idea how to do?

    I don't have a script. I need only a generic description on how you did.

    Thank you very much!

    According to my experience, assuming that you create a new entity for X under parent B, the best thing to do in these situations is to simply manage it via a journal entry.  You will write a day who would keep the CDA P & L (and in our cash flow of CDA case) result of X to the title of parent with equal and opposite impact hitting the new entity of X under B.  You post this journal in Sep, Oct, Nov and dec and continue loading data for a YEAR to X under B.

    However, if you simply drag & drop X under a new parent, I don't know how you deal with it.

    Kind regards
    Jason

  • Dealing with the merged cells in a table

    Hello

    I use tables often enough in InDesign, and I always ran into the same problem with the scripts - dealing with merged cells

    The number of lines, I have a few cells which are merged horizontally

    As I go through the cells in my selection, I want to test the line with the contents of the first cell in the same row - that is, the key to the line

    In short, that's what I want to do:

    1. Select the cells (manually)

    2. run the script that checks each cell in the selection to test if it is in a line that begins with 'TOTAL' - and then, act accordingly

    My problem is that the results are never is correct because some lines have merged cells

    In turn, column 1 could have 50 lines, but column 2 can only have 48 rows (because it has 2 m)

    That is why, when I check the contents of the first row as such:

    cells[1].parentRow.cells[0].contents
    

    He was not a match - even if it's in the same line.

    What is the best way to get around this problem?

    If anyone can give help on this topic, I would be very appreicate it

    Thank you

    Davey

    Why do you need to know the index of line? Isn't parentRow get you the line concerned? I tried to recreate it but I don't see the problem. Maybe you can post some more of your code where exactly is the shift is not clear.

  • Dealing with the Dates 2

    Hi guys,.

    I'm not a regular developer, I met always hedges when dealing with dates.

    I have a timestamp column, called 'Calling_date' which stores values as this "24 July 12 AM 05.30.00.000000".

    My report must show the data in this column as "YY-MM-DD hh: mi". I tried two methods but none worked.
    * I won't use To_char *.

    trunc (calling_time, "HH24 DD-MM-YY")
    ORA-01898: too much precision specifier

    TO_DATE (calling_time,'DD-MON-YY hh: mi ')
    ORA-01830: date format picture ends before converting all of the input string

    PLS, tell which can achieve my task.
    Kind regards
    FAteh...

    Fateh says:

    I have a timestamp column, called 'Calling_date' which stores values as this "24 July 12 AM 05.30.00.000000".

    My report must show the data in this column as "YY-MM-DD hh: mi". I tried two methods but none worked.
    * I won't use To_char *.

    Why not use TO_CHAR() ?

    Date and timestamp formats are BINARY formats. Is not a screen formats.

    This means that we MUST convert that binary in a human readable format. TO_CHAR() allows exactly that - convert to a format readable by humans and which allows you to specify exactly what that format is.

  • Can someone help me with the URL to download FB 4.7?

    I have problems with the 0209731770 case where the URL for me for the free update to Flash Builder 4.7 didn't work.  I got a response that I needed technical support.  The link they gave me was https://www.adobe.com/cfusion/tdrc/index.cfm?product=flash_builder2 , but it did not work.  Does anyone know the correct link?  Thank you!

    Visit this link: -.

    https://www.Adobe.com/cfusion/TDRC/index.cfm?product=flash_builder

  • Dealing with the size of the large file CS5/Aperture 3

    Is it possible to save a PS image changed completely without using 150 MB of storage? I opened a NAVE MB 18 of A3 to PS. converted to B & w using a variety of settings in CS5. Save as a PSD not flattened, gave a 150 MB file size. A flattened jpeg file is 18 MB. 150 MB images will quickly devour disk space. The warning in jpeg triangle suggests that not all layers are saved. Thank you.

    in order to save in layers, I'll have to deal with 150 MB of files.

    PSD files use compression (I forgot what the name), a file tif layered with one of the cuts without loss can be smaller but take longer to save and open.

    If I want to include all the layers in a jpeg file, flatten it before the record?

    If a file contains layers and you save a jpg file off it will automatically be a flattened image copy.

Maybe you are looking for