Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

System.stdin and UTF8 support #11277

Closed
xdenser opened this issue Apr 30, 2013 · 3 comments
Closed

System.stdin and UTF8 support #11277

xdenser opened this issue Apr 30, 2013 · 3 comments

Comments

@xdenser
Copy link

xdenser commented Apr 30, 2013

page.html

 <!DOCTYPE HTML>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">  
  </head>       
  <body>
    <h1>Привет мир!</h1>   
  </body>
</html> 

utf.js

var 
  page1 = require('webpage').create(),
  page2 = require('webpage').create(),
  system = require('system'),
  fs = require('fs'),
  text1 = system.stdin.read(),
  text2 = fs.read('page.html');

  page1.viewportSize = { width: 200, height : 50 };
  page2.viewportSize = { width: 200, height : 50 };

 page1.content = text1;
 page2.content = text2;    

 page1.render('stdin.png');
 page2.render('readFile.png');

 phantom.exit();

command to run :

type page.html | phantomjs.exe utf.js 

or

phantomjs.exe utf.js < page.html 

stdin.png
stdin

readFile.png
readfile

I have also tried from NodeJS using spawn and setting stdin encoding of child to 'utf8' with same result.

@JamesMGreene
Copy link
Collaborator

What OS? What version of PhantomJS?

Probably fixed in master via PR #11168 (and supplemental PRs #11210 and #11234).

@xdenser
Copy link
Author

xdenser commented May 1, 2013

Windows 7, 1.9.0 binary from site

@xdenser
Copy link
Author

xdenser commented May 1, 2013

Compiled master - no problem. Closing.

@xdenser xdenser closed this as completed May 1, 2013
JamesMGreene referenced this issue Jun 25, 2013
See [issue 333][1] and pull request #192.

**Caveat**

`File::read` currently takes no parameters and is equivalent to a
"`readAll`".  This will be changed later to match [IO/A Spec's
`Stream#read`][2]; but, should still be noted.

[1]: http://code.google.com/p/phantomjs/issues/detail?id=333
[2]: http://wiki.commonjs.org/wiki/IO/A#Instance_Methods
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants