Hi Adam, 1. http://base64.sourceforge.net/b64.c ?
2. Yes, there is something wrong with your encoding. Base64 should produce US-ASCII characters only, not something that would be mistaken for UTF-8. Are you sure you are not sending binary data? - Andy ________________________________ From: Adam Silberstein <[email protected]> To: [email protected] Sent: Friday, July 31, 2009 11:48:35 AM Subject: RE: rest calls using libcurl Thanks for your reply Andy. Given that I need Base64, a couple of followup questions: 1. Does anyone have suggestions for C++ libraries that do the Base64 conversion? I've been trying to use apache xerces, but it's heavyweight for just wanting encode/decode. 2. If values and columns need to be encoded, is this just within the xml that I am posting to HBase? I've tried just encoding value and column (i.e. the stuff between <name> and </name>, and <value> and </value>. I'm getting this error from HBase, making me think my encoding is bad: "Error 500 Invalid byte 1 of 1-byte UTF-8 sequence." Thanks, Adam ________________________________ From: Adam Silberstein Sent: Wednesday, July 29, 2009 1:27 PM To: '[email protected]' Subject: rest calls using libcurl Hi, I'm writing my own C++ client for Hbase by making rest calls with libcurl. I have simple set and get working, but have some minor problems that I'm stuck on. One problem is that when I do a put with libcurl and then do a get of the record with the HBase Shell, the record's value is a series of back-slashed characters...e.g \357\277\275... The second problem is that when I do a get using libcurl, the value field is always cutoff by a couple of characters. The column name, which should have been "f1:c1" also appears as something seemingly random: ZjE6YzE= I'm guessing I'm doing something wrong with my curl http headers, or something like that. My curl calls and results are below. If anyone has any suggestions, that would be great. Thanks! Adam PUT: POST /api/t2/row/r8?column=f1:c1 HTTP/1.1 Host: *****:5555 Pragma: no-cache Accept: */* Content-Type: text/xml;charest=UTF-8 Content-Length: 97 <?xml version="1.0" encoding="UTF-8"?><column><name>f1:c1</name><value>123456789</value></co lumn> GET: GET /api/t2/row/r8 HTTP/1.1 Host: *****:5555 Pragma: no-cache Accept: */* Content-Type: text/xml;charest=UTF-8 RESULT FROM GET: <?xml version="1.0" encoding="UTF-8"?> <row> <count> 1 </count> <column> <name> ZjE6YzE= </name> <value> 12345678 </value> <timestamp> 1248898993641 </timestamp> </column> </row> RESULT FROM GET IN SHELL: hbase(main):001:0> get 't2', 'r8' COLUMN CELL f1:c1 timestamp=1248898993641, value=\357\277\275m\357\277\275
