We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
ISO-8859-1 (Read 637 times)
ISO-8859-1
Feb 11th, 2009, 10:11pm
 
I am using the processing network library and am trying to access a website with ISO-8859-1 encoding

This is the code I am using it is a sample from the documentation. I apologize I can not share the URL I am working with. Where I have www.google.com I am using my own website with ISO-8859-1 encoding. I am trying to connect to a printer website.

Thank you for any help in advance.


import processing.net.*;

Client c;
String data;

void setup() {
 size(200, 200);
 background(50);
 fill(200);
 c = new Client(this, "www.google.com", 80); // Connect to server on port 80
  c.write("GET / HTTP/1.1\n"); // Use the HTTP "GET" command to ask for a Web page
 c.write("Host: my_domain_name.com\n\n"); // Be polite and say who we are
}

void draw() {
   if (c.available() > 0) { // If there's incoming data from the client...
   data = c.readString(); // ...then grab it and print it
   println(data);
 }
}

Re: ISO-8859-1
Reply #1 - Feb 11th, 2009, 10:52pm
 
ISO-8859-1 is a very common encoding, and should "just work" what problems are you actually experiencing?
Re: ISO-8859-1
Reply #2 - Feb 12th, 2009, 12:48pm
 
As JohnG said...
I tried with my own Web site, which uses this encoding for French:
Code:
void setup() {
size(200, 200);
background(50);
fill(200);
c = new Client(this, "phi.lho.free.fr", 80);
c.write("GET /index.fr.html HTTP/1.1\r\n");
c.write("Host: phi.lho.free.fr\r\n\r\n");
}

And I get the code of the page correctly.
Page Index Toggle Pages: 1