tx <- "I want: spaces around all these marks;:!?.but i didn’t want it there in didn't"
gsub("\\s*(\\.+|[[:punct:]])(?<!\\b['’]\\b)\\s*", " \\1 ", tx, perl=TRUE)
dHggPC0gIkkgd2FudDogc3BhY2VzIGFyb3VuZCBhbGwgdGhlc2UgbWFya3M7OiE/LmJ1dCBpIGRpZG7igJl0IHdhbnQgaXQgdGhlcmUgaW4gZGlkbid0Igpnc3ViKCJcXHMqKFxcLit8W1s6cHVuY3Q6XV0pKD88IVxcYlsn4oCZXVxcYilcXHMqIiwgIiBcXDEgIiwgdHgsIHBlcmw9VFJVRSk=