DATA Step, Macro, Functions and more

Failed to transcode data from UTF-16LE to wlatin1

Accepted Solution Solved
Reply
Contributor jei
Contributor
Posts: 61
Accepted Solution

Failed to transcode data from UTF-16LE to wlatin1

Hi!

 

I'm trying ti import an XML file using this script

filename outfile "C:\Users\jgmanalo\Desktop\Sample1\From URL\OutXML.xml" encoding= 'UTF-8';
libname source xml "C:\Users\jgmanalo\Desktop\Sample1\From URL\OutXML.xml";
proc http
	out = outfile
	url = 'https://rbc-svr-pi/webacs/api/v1/data/ClientDetai​ls?.full=true'
	method = 'get';
run;

 But an error occured.

 

 

1.JPG

 

May I know how to solve the error? Thank you!


Accepted Solutions
Solution
‎06-16-2016 04:40 AM
PROC Star
Posts: 1,561

Re: Failed to transcode data from UTF-16LE to wlatin1

 

Mmm don't know what to say except that this web site really screws characters sometimes (but not always).

 

I get the same message as you but after cleaning I can run the code and I get the expected proc http error

 

ERROR: Host name resolution failed

 

To clean, delete every space and end-of-line character and add them manually again.

 

Run each line separately to see which one still contains bad characters.

 

 

 

View solution in original post


All Replies
Super User
Posts: 9,681

Re: Failed to transcode data from UTF-16LE to wlatin1

Can you change your SAS session's encoding  into utf-16le? in sas configure file ?

 

PROC Star
Posts: 1,561

Re: Failed to transcode data from UTF-16LE to wlatin1

The error point to bad characters in the program itself. This very web site embeds such characters in posted programs.

Admins, anything you can do to avoid this?

 

Try this cleaned version:

 

filename outfile 'C:\Users\jgmanalo\Desktop\Sample1\FromURL\OutXML.xml' encoding='UTF-8';

libname source xml 'C:\Users\jgmanalo\Desktop\Sample1\FromURL\OutXML.xml';

proc http out=outfile url='https://rbc-svr-pi/webacs/api/v1/data/ClientDetails?.full=true' method='get';run;

 

 

Contributor jei
Contributor
Posts: 61

Re: Failed to transcode data from UTF-16LE to wlatin1

The error is still the same.
PROC Star
Posts: 1,561

Re: Failed to transcode data from UTF-16LE to wlatin1

Grrr. Yes the rogue characters have been inserted again.

 

Try the attached file.

Contributor jei
Contributor
Posts: 61

Re: Failed to transcode data from UTF-16LE to wlatin1

still the same.
Solution
‎06-16-2016 04:40 AM
PROC Star
Posts: 1,561

Re: Failed to transcode data from UTF-16LE to wlatin1

 

Mmm don't know what to say except that this web site really screws characters sometimes (but not always).

 

I get the same message as you but after cleaning I can run the code and I get the expected proc http error

 

ERROR: Host name resolution failed

 

To clean, delete every space and end-of-line character and add them manually again.

 

Run each line separately to see which one still contains bad characters.

 

 

 

Contributor jei
Contributor
Posts: 61

Re: Failed to transcode data from UTF-16LE to wlatin1

Hi @ChrisNZ

I retyped all and no error occured. But no data on the resuletd XML file as seen on the image below

2.JPG

 

May I know if you have any idea about resful API on sas and how to code it? I think the step on the link should follow in order to get the data.

https://developer.cisco.com/media/prime-infrastructure-api-reference-v3-0/192.168.115.187/webacs/api...

 

 

PROC Star
Posts: 1,561

Re: Failed to transcode data from UTF-16LE to wlatin1

That's a a different issue. Now that this is solved and the code can run, best to open a new incident with the appropriate title so the right people can be involved.

Contributor jei
Contributor
Posts: 61

Re: Failed to transcode data from UTF-16LE to wlatin1

Alright. Thanks!
Super User
Posts: 9,681

Re: Failed to transcode data from UTF-16LE to wlatin1

Can you run OS command at SAS side ?

 

x 'curl -k "https://user:password@my_server/webacs/api/v1/data/Devices?.full=true"  >  C:\Users\jgmanalo\Desktop\Sample1\FromURL\OutXML.xml ';

Then run my code .

PROC Star
Posts: 1,561

Re: Failed to transcode data from UTF-16LE to wlatin1

@Ksharp Sorry I didn't see your answer when I asked for the solved flag to be set. I didn't mean to discount your post.

Super User
Posts: 9,681

Re: Failed to transcode data from UTF-16LE to wlatin1

Chris,

That is OK. I really don't care about that.

You must are using IE ? Try Chrome .

Contributor jei
Contributor
Posts: 61

Re: Failed to transcode data from UTF-16LE to wlatin1

yes I'm trying this code
Contributor jei
Contributor
Posts: 61

Re: Failed to transcode data from UTF-16LE to wlatin1

Hi @Ksharp,

 

I tried this code

x 'curl -k "https://user:password@my_server/webacs/api/v1/dat​a/Devices?.full=true"  >  C:\Users\jgmanalo\Desktop\Sample1\FromURL\OutXML.x​ml ';

It says that >C does not recognized.

 

 

and I tried only the

 

x 'curl -k "https://userSmiley Tongueassword@my_server/webacs/api/v1/dat​a/Devices?.full=true" >OutXML.x​ml ';

and it was successful. But I don't know where local file it was saved and when I'm searching it it says that no result found.

Do you have any idea where i can found the file?

 

Thank you!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 17 replies
  • 1275 views
  • 0 likes
  • 4 in conversation