Brad Johnson at 2012-07-09 10:09:27:
Not only was the line improvised - but the entire scene was not originally in the script. Harrison Ford was not under contract for a third film, and so Lucas needed a way to handle the character which would allow for him to be revived or remain off-screen for Jedi, depending on how contract negotiations went. It doesn't take away from the scene itself, but it is a great example of how the realities (and business) of film-making can impact the creative side.
Teddy Pasternak at 2012-07-09 11:12:17:
Here is director Irvin Kershner's version of what transpired from an interview in Vanity Fair October 2010: There was really only one disagreement. It was the Carbon Freeze scene when Princess Leia says, “I love you.” Han Solo’s response in the script was, “I love you, too.” I shot the line and it just didn’t seem right for the character of Han Solo. So we worked on the scene on the set. We kept trying different things and couldn’t get the right line. We were into the lunch break and I said to Harrison try it again and just do whatever comes to mind. That is when Harrison said the line, “I know.” After the take, I said to my assistant director, David Tomblin, “It’s a wrap.” David looked at me in disbelief and said something like, “Hold on, we just went to overtime. You’re not happy with that, are you?” And I said, yes, it’s the perfect Han Solo remark, and so we went to lunch. George saw the first cut and said, “Wait a minute, wait a minute. That’s not the line in the script.” I said ““I love you, too’ was not Han Solo.” Han Solo was a rebel. George felt that the audience would laugh. And I said, that’s wonderful, he is probably going to his death for all they know. We sat in the room and he thought about it. He then asked me, “Did you shoot the line in the script?” I said yes. So we agreed that we would do two preview screenings once the film was cut and set to music with the line in and then with the line out. At the first preview in San Francisco, the house broke up after Han Solo said I know. When the film was over, people came up and said that is the most wonderful line and it worked. So George decided not to have the second screening.