Is there any way to uuencode data in the iPhone SDK? An API call or perhaps a library?
Asked
Active
Viewed 1,088 times
0
-
what type of data are you talking about?? You need to clarify this question – zpesk Oct 15 '09 at 16:18
-
binary data, nothing specific, NSData objects. – luvieere Oct 15 '09 at 16:49
-
Just out of curiosity, why would you need to be able to uuencode data from an iPhone app? – Jarett Millard Oct 15 '09 at 16:59
-
So I can email it or post it to a server that only accepts text input. – luvieere Oct 15 '09 at 17:21
2 Answers
1
There isn't a built-in API to uuencode data, no, but the algorithm is pretty straightforward (the Wikipedia article gives a good overview), and there's plenty of C source code out in the world (here's one example that looks like it's freely available/reusable). Since uuencode operates at the level of bytes, C code should be fine... you can get bytes from an NSData directly, or with NSString methods like UTF8String
and cStringUsingEncoding
.

Sixten Otto
- 14,816
- 3
- 48
- 60