My script allows you to drawn shapes on an OpenLayers map, and then to get the WKT information from that shape, except the returned coordinates are in EPSG::900913 and I need them to be in lat/lon.
You need to project (transform) the shape from EPSG:900913 (actually use the standard EPSG:3857) to EPSG:4326.
You can use the following code:
var gcs=new OpenLayers.Projection("EPSG:4326"); var webMercator=new OpenLayers.Projection("EPSG:3857"); /*I am assuming that you have a polygon in web mercator. You can do this for points and lines as well*/ var polygon_wgs84=poly.transform(webMercator, gcs); //now you can convert the polygon to wkt console.log(polygon_wgs84.toString(););