0
Base64 to string
Participant
,
/t5/coldfusion-discussions/base64-to-string/td-p/410404
Mar 21, 2008
Mar 21, 2008
Copy link to clipboard
Copied
Hi,
I have a text that has been converted using ToBase64 and I am trying to convert it back to string. I am trying to use BinaryDecode with Base64 encoding to convert it but it keeps telling me that text must be valid binary object?
Please help!
I have a text that has been converted using ToBase64 and I am trying to convert it back to string. I am trying to use BinaryDecode with Base64 encoding to convert it but it keeps telling me that text must be valid binary object?
Please help!
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Contributor
,
/t5/coldfusion-discussions/base64-to-string/m-p/410405#M36948
Mar 21, 2008
Mar 21, 2008
Copy link to clipboard
Copied
"ToString" function?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Contributor
,
/t5/coldfusion-discussions/base64-to-string/m-p/410406#M36949
Mar 21, 2008
Mar 21, 2008
Copy link to clipboard
Copied
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
TiGGi
AUTHOR
Participant
,
/t5/coldfusion-discussions/base64-to-string/m-p/410407#M36950
Mar 21, 2008
Mar 21, 2008
Copy link to clipboard
Copied
ToString on it's own doesn't work, I can make it work with
tostringToBinary(text)) but Adobe documentation recommends to use
BinaryDecode instad of the ToBinary
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Contributor
,
/t5/coldfusion-discussions/base64-to-string/m-p/410408#M36951
Mar 21, 2008
Mar 21, 2008
Copy link to clipboard
Copied
What I have seen that after getting the binary version you
just need to use ToString to convert into string "text" format.
<cfset yourText = toString(toBinary(YourData64))>
<cfset yourText = toString(toBinary(YourData64))>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/coldfusion-discussions/base64-to-string/m-p/410409#M36952
Mar 21, 2008
Mar 21, 2008
Copy link to clipboard
Copied
TiGGi wrote:
I have a text that has been converted using ToBase64 and I am trying to convert it back to string. I am trying to use BinaryDecode with Base64 encoding
Use BinaryEncode() not BinaryDecode()
stringData = BinaryEncode(toBinary(yourBase64Data), "base64")
I have a text that has been converted using ToBase64 and I am trying to convert it back to string. I am trying to use BinaryDecode with Base64 encoding
Use BinaryEncode() not BinaryDecode()
stringData = BinaryEncode(toBinary(yourBase64Data), "base64")
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Valorous Hero
,
/t5/coldfusion-discussions/base64-to-string/m-p/410410#M36953
Mar 21, 2008
Mar 21, 2008
Copy link to clipboard
Copied
TiGGi wrote:
> I have a text that has been converted using ToBase64 and I am trying to convert it back to string.
Your question is confusing. Base64 text is a string. Do you mean you want to convert a base64 string back into binary? As BKBK mentioned, BinaryEncode will convert binary data to base64 and BinaryDecode will convert base64 back into binary. Do you understand the difference?
> I have a text that has been converted using ToBase64 and I am trying to convert it back to string.
Your question is confusing. Base64 text is a string. Do you mean you want to convert a base64 string back into binary? As BKBK mentioned, BinaryEncode will convert binary data to base64 and BinaryDecode will convert base64 back into binary. Do you understand the difference?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
TiGGi
AUTHOR
Participant
,
/t5/coldfusion-discussions/base64-to-string/m-p/410411#M36954
Mar 24, 2008
Mar 24, 2008
Copy link to clipboard
Copied
cfSearching
Text was converted using toBase64 now I need to convert it back to text again.
I used toString(ToBinary(base64text)) to convert it back to text. My question was since CF documentation recommends using BinaryDecode instead of ToBinary, how do I use BinaryDecode? I was not able to figure it out.
Text was converted using toBase64 now I need to convert it back to text again.
I used toString(ToBinary(base64text)) to convert it back to text. My question was since CF documentation recommends using BinaryDecode instead of ToBinary, how do I use BinaryDecode? I was not able to figure it out.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Contributor
,
/t5/coldfusion-discussions/base64-to-string/m-p/410412#M36955
Mar 24, 2008
Mar 24, 2008
Copy link to clipboard
Copied
<cfset myText = "This is my Unicode Text
ğĞüÜıİşŞöÖçÇ">
<cfdump var="#myText#">
<br />
<cfset mybase64 = toBase64(myText)>
<cfdump var="#mybase64#">
<br />
<cfset myTextBack = toString(ToBinary(mybase64))>
<cfdump var="#myTextBack#">
This works.
Same thing with BineryDecode
<cfset myTextBack = toString(BinaryDecode((mybase64),'Base64'))>
<cfdump var="#myText#">
<br />
<cfset mybase64 = toBase64(myText)>
<cfdump var="#mybase64#">
<br />
<cfset myTextBack = toString(ToBinary(mybase64))>
<cfdump var="#myTextBack#">
This works.
Same thing with BineryDecode
<cfset myTextBack = toString(BinaryDecode((mybase64),'Base64'))>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Valorous Hero
,
LATEST
/t5/coldfusion-discussions/base64-to-string/m-p/410413#M36956
Mar 24, 2008
Mar 24, 2008
Copy link to clipboard
Copied
TiGGi wrote:
I used toString(ToBinary(base64text)) to convert it back to text. My question was since CF documentation recommends using BinaryDecode instead of ToBinary, how do I use BinaryDecode? I was not able to figure it out.
IIRC I believe they are referring to binary data specifically. For text you may still need to use the previous functions.
I used toString(ToBinary(base64text)) to convert it back to text. My question was since CF documentation recommends using BinaryDecode instead of ToBinary, how do I use BinaryDecode? I was not able to figure it out.
IIRC I believe they are referring to binary data specifically. For text you may still need to use the previous functions.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

