Alex Rivera | Logout

How to encode a URI to safely store in the RowKey of a TableServiceEntity?

Asked 2012-09-21T13:32:02.900
8

I would really, really like to store a URI as the RowKey value in Azure Table storage. According to the documentation, RowKeys can't contain characters commonly found in URIs (/, \, #, ?).

The solution seems simple: Just encode the URI. But that doesn't work. For whatever reason, any values containing the sequence %2f (the encoded value for a forward-slash) can be inserted, but not queried even though '%2f' does not contain any forbidden characters.

Okay, so how about base64 encoding? Nope. It produces the occasional forward-slash character, which is not allowed.

So is there a method of encoding a string (a URI) that can be reliably stored as the RowKey in Azure Table? Preferably, but not necessarily, something human-readable.

Edit
Report

1 Answer

0

Replace all the illegal row key characters in the URL (\, /, ?) with characters that are illegal in URLS (eg <, >, %)

answered 2013-02-14T09:17:32.737

Your Answer