Removing line breaks from base64 encoded dataPosted: January 25, 2017
You may experience a weird problem, when you attempt to embed base64 encoded TTF font file in a Web page with CSS @font-face and the font just does not work. You try decompressing the base64 data, and get perfectly valid TTF file. Everything is fine, but nothing works.
Well, the problem is caused by line breaks in the base64 encoded data. It is said that those line breaks are there because once upon a time software could not handle long strings. Well, these days it is obviously the opposite. Web browsers seem unable to handle base64 data with line breaks SOMETIMES, because base64 encoded images work perfectly well even if there are the breaks. The fonts don’t though.
Whatever. Take your base64 encoded file and run this command on the command line:
tr -d "\n\r" < Font.base64 > Font-valid.base64