トップページ > 記事閲覧
【質問】スクロールのポインターが、文字化け
投稿日 : 2020/09/15(Tue) 19:23
投稿者 ran
参照先
バージョンアップ( HAIK v7.3.7 )するとスクロールのポインターが「トップ」と言う文字が化けになります。今迄、その様な現象が起きませんでした。以下に scrollup.inc.php scrollbox.inc.phpのソースをアップしていました。
何処に問題があるのか特定できません。教えて下されば、感謝です。

<?php
/**
* トップに戻るリンク
* -------------------------------------------
* scrollup.inc.php
*
* Copyright (c) 2014 hokuken
* http://hokuken.com/
*
* created : 14/08/26
* modified :
*
* Usage :
* #scrollup
*
*/
function plugin_scrollup_convert()
{
$args = func_get_args();

$qt = get_qt();

$target = 'body';
$title = 'このページのトップへ';
if (count($args) > 0)
{
$target = h(trim($args[0]));
if (isset($args[1]))
{
$title = h(trim($args[1]));
}
}

if (exist_plugin('icon'))
{
plugin_icon_set_font_awesome();
}

$add_style = <<< EOD
<style data-qhm-plugin="scrollup">
.qhm-plugin-scrollup {
color: #16D9DC;
bottom: 12px;
right: 12px;
cursor: pointer;
}
.qhm-plugin-scrollup.affix:hover {
color: #00008b;
opacity: .8;
}
</style>
EOD;
$qt->appendv_once('plugin_scrollup_style', 'beforescript', $add_style);

$add_script = <<< EOD
<script data-qhm-plugin="scrollup">
$(function() {
$("body").append('<a class="qhm-plugin-scrollup"></a>').find(".qhm-plugin-scrollup")
.html('<i class="fa fa-arrow-up fa-3x"></i>')
.html('<i class="fa fa-arrow-circle-o-up fa-3x"></i>')
.attr({
'data-target': "{$target}",
'title': "{$title}"
})
.affix({
offset: {
top: 50
}
});

$(".qhm-plugin-scrollup").on("click", function(e){
QHM.scroll($(this).data("target"));
e.preventDefault();
return false;
});
});
</script>
EOD;

$qt->appendv_once('plugin_scrollup_script', 'lastscript', $add_script);

return;
}

====


<?php
/**
* QHM Scroll Box Plugin
* -------------------------------------------
* plugin/scrollbox.inc.php
*
* Copyright (c) 2010 hokuken
* http://hokuken.com/
*
* Usage :
*
*/

function plugin_scrollbox_convert()
{
$args = func_get_args();
$last = func_num_args() - 1;

if (strpos($args[$last], 'style=') === 0) {
} elseif (strpos($args[$last], 'class=') === 0) {
} else {
$body = array_pop($args);
}

list($w,$h,$option) = array_pad($args,3,'');
$w = ($w == '') ? '100%' : $w;
$h = ($h == '') ? '200px' : $h;
$option = ($option == '') ? 'overflow:auto;border:1px solid #dcdcdc;padding:5px 10px;margin-left:auto;margin-right:auto;text-align:justify;' : $option;
$option = h($option);

if (isset($body)) {
$body = str_replace("\r", "\n", str_replace("\r\n", "\n", $body));
$lines = explode("\n", $body);
$body = convert_html($lines);
} else {
$body = '';
}

$ret = '<div style= "';
$ret .= 'width:'.$w.';';
$ret .= 'height:'.$h.';';
$ret .= $option.';"';
$ret .= '>';
$ret .= $body;
$ret .= '</div>';
return $ret;
}
?>
Re: スクロールのポインターが、文字化け
投稿日 : 2020/09/16(Wed) 16:06
投稿者 ran
参照先
いしまる◆vOmCuTAP2Tw様
アドバイスを頂き、ありがとうございます。
試行錯誤の中で結論的には、バックアップされていた前のプラグインフォルダごとだけ、全てのソースを上書きアップしました。
結果、現在のところ文字化けもなく正常に表示されています。
だが、何故に「文字化け」になったのか?根本的な原因を見つけられえずにいます。文字コードは全てUTF-8になっていました。
バージョンアップした場合は、時間を要しますが、スクロールソースファイルを個別でなく全てを取り換えるべきではと考えています。
Re: スクロールのポインターが、文字化け
投稿日 : 2020/09/16(Wed) 10:54
投稿者 いしまる◆vOmCuTAP2Tw
参照先 https://haik.oi21.net/
ドットで命令等を繋げていく書き方はメソッドチェーンといいますが、
この場合は.htmlが2回あっても後の方で上書きされ、最初のは無効に
なります。
Re: スクロールのポインターが、文字化け
投稿日 : 2020/09/16(Wed) 05:07
投稿者 うみほし
参照先
怪しそうなのはこの部分かも。

$add_script = <<< EOD
<script data-qhm-plugin="scrollup">
$(function() {
$("body").append('<a class="qhm-plugin-scrollup"></a>').find(".qhm-plugin-scrollup")
.html('<i class="fa fa-arrow-up fa-3x"></i>')  ←矢印のアイコンの指定。
.html('<i class="fa fa-arrow-circle-o-up fa-3x"></i>') ←矢印のアイコンの指定が二重では?
.attr({
'data-target': "{$target}",
'title': "{$title}"
})
.affix({
offset: {
top: 50
}
});

矢印で示した行はアイコン指定が2つです。これは1個でよいはず。存在しないアイコンを指定すると,文字化けするのかも。
管理人さんのTipsの記事,
https://haik.qhmtips.com/index.php?%E3%81%9D%E3%81%AE%E4%BB%96
を参考にしました。
Re: スクロールのポインターが、文字化け
投稿日 : 2020/09/15(Tue) 20:46
投稿者 いしまる◆vOmCuTAP2Tw
参照先 https://haik.oi21.net/
scrollup.inc.php にはプログラム中に表示に関係する部分に
日本語があります。テクストエディタでソースファイルを
編集する際の文字コードはUTF-8となっていて、保存時も
UTF-8となっていますか?

文字化けの可能性が高くなる原因は多くはソースコードの
文字コードが予定しているものから別のものに変化した
場合です。

HAIKの場合は基本的にソースコードの文字コードはUTF-8です。
テキストエディタでの保存時にUTF-8以外が選択されていない事、
FTPでアップロードする際に文字コードの変換せずにUTF-8の
ままアップロードしているかをまず確認されると
良いと思います。

- WEB PATIO -