Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert.js:33 error on Node.js v0.10.0 #95

Closed
reutopiaer opened this issue Mar 12, 2013 · 6 comments
Closed

convert.js:33 error on Node.js v0.10.0 #95

reutopiaer opened this issue Mar 12, 2013 · 6 comments

Comments

@reutopiaer
Copy link

/node_modules/passport-openid/node_modules/openid/lib/convert.js:33

if(i.charCodeAt(0) > 127)
^

TypeError: Object ��:
�9r����Ţ�1�7q~��q�v#s�f���Z.'�������zc�?)�X�Ӳ�9��h7W}E���-��z��v�ΧK�H�߯����%��NE��f4��I��5̂�H;�v">]I
%������"� has no method 'charCodeAt'

https://github.com/joyent/node/blob/v0.10.0-release/ChangeLog

  • buffer: Strip high bits when converting to ascii (Ben Noordhuis)
@paulhandy
Copy link

As I am not a collaborator, I am not allowed to push a branch, so I leave code that works to change in lib/convert.js
New:

function btwoc(i)
{
try{
if(i.charCodeAt(0) > 127)
{
return String.fromCharCode(0) + i;
}
return i;
}catch(error){
var j = i.base64Slice(0,i.length-1);
if(j.charCodeAt(0) > 127)
{
return String.fromCharCode(0) + j;
}
return j;
}
}

Old:

function btwoc(i)
{
if(i.charCodeAt(0) > 127)
{
return String.fromCharCode(0) + i;
}
return i;
}

Works like a charm on my system.

@dertseha
Copy link

The core issue is actually a change in node's API, such as in crypto: http://nodejs.org/docs/v0.10.0/api/crypto.html#crypto_recent_api_changes where buffer objects are returned instead of binary.

@reutopiaer
Copy link
Author

Thank you very much! You are so kind and did a god job! That's very helpful
to me :)

2013/3/19 Christian Haas notifications@github.com

The core issue is actually a change in node's API, such as in crypto:
http://nodejs.org/docs/v0.10.0/api/crypto.html#crypto_recent_api_changeswhere buffer objects are returned instead of binary.

¡ª
Reply to this email directly or view it on GitHubhttps://github.com//issues/95#issuecomment-15083554
.

Öع¹ÎÚÍаî

@havard
Copy link
Owner

havard commented Mar 19, 2013

Fixed in 9fdb731

@havard havard closed this as completed Mar 19, 2013
@al6x
Copy link

al6x commented Mar 25, 2013

Can You please publish that fix to npm?

@havard
Copy link
Owner

havard commented Mar 28, 2013

Pushed v0.5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants