开发者

Why do code files containing unicode string constants saved as UTF8 + BOM display correctly but when saved as UTF8 they do not in classic ASP?

开发者 https://www.devze.com 2022-12-25 13:48 出处:网络
I have a code file which I will refer to as \"myConstants.res.asp\" with a bunch of constants in both English and French...

I have a code file which I will refer to as "myConstants.res.asp" with a bunch of constants in both English and French...

<% 
  const myStr1 = "Bienvenue dans ma maison au moment de cette belle journée de repos et de détente"
  const myStr2 = "Welcome to my house at this beautiful day of rest and relaxation"

  ... more constants ...
%>

This constant file is included in other ASP code files that have the following structure...

<%@ Language="VBSCRIPT" EnableSessionState=False %>
<% 
    Option Explicit 
   开发者_StackOverflow社区 Response.CharSet  = "UTF-8"
    Response.CodePage = 65001    
%>

<!-- #include file = "myConstants.res.asp" -->

... additional code ...

If I save the myConstants.res.asp file as UTF8+BOM Unicode characters are displayed correctly which in my example case is only an issue for the constant myStr1. In reality I have several hundred of these strings. If I save the myConstants.res.asp file as UTF8 (no BOM). The Unicode characters show up as garbage.

Any thoughts as to why this is happening?


Could be the file doing the including is encoded differently?

0

精彩评论

暂无评论...
验证码 换一张
取 消