<%@ page language="java" contentType="text/html; charset=UTF-8" %> <% // UTF-8!!!! String url = request.getParameter("q"); String enabletags = ""; String textOfURL = ""; String actualLine = ""; java.net.HttpURLConnection uc = (java.net.HttpURLConnection) new java.net.URL(java.net.URLDecoder.decode(url)).openConnection(); uc.connect(); String contentType = uc.getContentType(); String charset = contentType.substring(contentType.indexOf("=")+1); //System.out.println("ct:" + charset); //Content-Type: text/html; charset=ISO-8859-4 java.io.BufferedReader rd = null; //if (request.getParameter("forceencoding") != null) if (charset != null) { out.println(""); //out.println(""); rd = new java.io.BufferedReader(new java.io.InputStreamReader(uc.getInputStream(), charset)); //rd = new java.io.BufferedReader(new java.io.InputStreamReader(uc.getInputStream(), "utf-8")); } else rd = new java.io.BufferedReader(new java.io.InputStreamReader(uc.getInputStream())); StringBuilder sb = new StringBuilder(); while ((actualLine = rd.readLine()) != null) sb.append(actualLine + '\n'); textOfURL = new String(sb); if (request.getParameter("enabletags") == null) textOfURL = textOfURL.replaceAll("\\<[^>]*>",""); else enabletags = "enabletags=true&"; for (int i=0; i<10; i++) { textOfURL = textOfURL.replaceAll("\t"," "); textOfURL = textOfURL.replaceAll(" "," "); textOfURL = textOfURL.replaceAll("\r","\n"); textOfURL = textOfURL.replaceAll("\n ","\n"); textOfURL = textOfURL.replaceAll("\n\n","\n"); } String origTxt = textOfURL; int textLength = textOfURL.length(); int blockSize = 2000; //int blocknr = -1; for (int blocknr=0; blocknr<=textLength / blockSize; blocknr++) { out.println("

Block "+blocknr); if (blocknr != textLength / blockSize) textOfURL = origTxt.substring(blocknr*blockSize, (blocknr+1)*blockSize); else textOfURL = origTxt.substring(blocknr*blockSize, textLength); out.println("

"); } %>
Click this to switch to tag-enabled mode if you don't see anything
Click this to switch to enable UTF-8 mode
Click this to switch to enable 8859-2 mode
Click this to switch to enable Windows-1250 mode

Opera Mini copy helper (C) Werner "Menneisyys" Ruotsalainen, 2009.