Strange white space in html when using custom TPL in Drupal

Recently we encountered a strange issue.
We had some custom templates for drupal views.
Some extra white space was coming just before the content of the TPL was starting.
Usually white space is ignored in HTML, but for some strange reason this white space was not ignored in IE7 , and was causing the design issue.

When we removed the custom TPL files the white space was disappearing.

Even if we put the default TPL code in the custom file, the issue was still there.

Finally we figured out that the tpl file was saved in UTF-8 encoding which was causing this issue. once we changed the encoding of the TPL file to ANSI, the problem was solved.