Zend headTitle() 编码问题
我对 Zends headTitle 命令和特殊字符(主要是瑞典字符 (åäö))有疑问。在我的布局中,我指定了如下标题:
$this->headTitle('标题 - ','PREPEND');
然后,在我的控制器中,我指定不同的字幕,如下所示:
$this->view->headTitle = "副标题";
只要所有字符都是 ASCII,这种方法就可以正常工作,但是一旦我在副标题中添加其他内容,页面标题就会从“标题 - 副标题”变为“URI”,因此标题将变为“http://mydoman.se/” controller/action/"
页面的编码由zend trough设置
$this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=ISO-8859-1');
当我查看 html 输出时,编码是根据浏览器正确设置的。 所有文件的编码都是ISO-8859-1,我的数据库也是如此。我尝试过的所有特殊字符都适用于网站的其余部分,那么为什么它在标题中不起作用?
任何帮助将不胜感激。 (注意,它确实适用于编码 UTF-8,但由于各种原因我现在必须在实时环境中使用 ISO-8859-1)
I have a problem with Zends headTitle command and special characters, mainly Swedish characters (åäö). In my layout i have specified a header like this:
$this->headTitle('Title - ','PREPEND');
In my controllers I then specify different subtitles like this:
$this->view->headTitle = "Subtitle";
This works fine so long as all characters are ASCII but as soons as I put anything else in the subtitle the Title of my page goes from "Title - Subtitle" to "URI" ergo the title becomes "http://mydoman.se/controller/action/"
The encoding for the page is set by zend trough
$this->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=ISO-8859-1');
the encoding is correctly set according to the browser and when I review the html output.
The encoding of all files are ISO-8859-1, and the same goes for my database. All special chars I've ever tried works in the rest of the site, so why doesn't it work in the title??
Any help would be very appreciated. (Note, it did work with encoding UTF-8, but for various reasons I must use ISO-8859-1 in the live environment for now)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须在以下位置设置编码:
application.ini
中)You have to set encoding in:
application.ini
)