ホーム » Iwao の投稿 (ページ 22)

作者アーカイブ: Iwao

2025年5月
 123
45678910
11121314151617
18192021222324
25262728293031

カテゴリー

アーカイブ

ブログ統計情報

  • 113,026 アクセス


FBX SDK 2020.1

FBX SDK の脆弱性」の記事を先日読んでいた.
それで SDKダウンロード する所を見ると,対応版と思われる 2020.1 があった.
FBX SDK 2020.1


「追加のインクルードディレクトリ」と「追加のライブラリディレクトリ」を 2020.1 に.
追加のインクルードディレクトリ
追加のライブラリディレクトリ
ビルドすると大量の warning .

LibXml2-MD.lib(buf.obj) : warning LNK4099: PDB 'libxml2-md.pdb' が 'LibXml2-MD.lib(buf.obj)' で、または 'c:\Temp\...\Debug.141\Win32\libxml2-md.pdb' に見つかりません。デバッグ情報がないものとして、オブジェクトにリンクします。
Zlib-MD.lib(adler32.obj) : warning LNK4099: PDB 'zlib-md.pdb' が 'Zlib-MD.lib(adler32.obj)' で、または 'c:\Temp\...\Debug.141\Win32\zlib-md.pdb' に見つかりません。デバッグ情報がないものとして、オブジェクトにリンクします。
LibFbxSDK-MD.lib(OArchive.cpp.obj) : warning LNK4099: PDB 'alembic-md.pdb' が 'LibFbxSDK-MD.lib(OArchive.cpp.obj)' で、または 'c:\Temp\...\Debug.141\Win32\alembic-md.pdb' に見つかりません。デバッグ情報がないものとして、オブジェクトにリンクします。

FBX SDK 2020.1 で LNK4099
どこか,プロジェクトの設定を間違えたか?


2021/04/29
LNK4099 のエラーは,pdb がないため.
FBX SDK 2020.1.1 以降であれば用意されているので,それぞれにあったものをインストールする.
FBX SDK 2020.1.1 pdb

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Win10 インストール 用 USB 作成

Win10 インストール用の USB を作成しようと思い調べていたら


Windows 用のインストール メディアを作成する
その先の「Windows 10 のダウンロード」に入り「ツールを今すぐダウンロード」.
ダウンロードしたファイル MediaCreationTool2004.exe を起動.
ライセンス条項に「同意」して,実行する操作を選択.
実行する操作を選択
Windows の種類を選択.
Windows の種類を選択
メディアを選択.
メディアを選択
ドライブを選択.
ドライブを選択
Windows 10 をダウンロード.
Windows 10 をダウンロード
USB メモリに書き込み.メディアの作成時間は 15 分位.
メディアの作成


作成される Windows のバージョンにはご注意ください.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

弦と矢と半径 – 7

input タグで number を使用している部分.
step=’0.001′ などとすれば小数値を入力できるが,欲しい動作ではない.
例えば 1.23456789 など任意の値を入力可能にしたかった.
step=’any’ と指定することで小数部を入力できるようになる.
<input type=’number’ name=’c’ value=’1.234567890′ size=’15’ step=’any’ />
https://mish.myds.me/…/r_cs/7/
弦と矢と半径 7

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

PHP escapeshellarg

以前から気にはなっていた PHP の escapeshellarg を調べてみた.


次の様なコードがうまくない.

<?php
	$param  = ($_REQUEST['input']) ;
	$cmd_to = "cal " . $param ;
	system	( $cmd_to ) ;
	?>

次の様な入力を意図しているが,
…/cal/?input=2020
cal 2020
後ろに次のコマンドを付加されるとうまくない.
…/cal/?input=2020;ls -l
cal 2020 ; ls -l
cal 2020 が表示された後 ls -l が動作している.
コマンドインジェクション」と呼ぶらしく,検索するといろいろと出てくる.


コマンドの引数にあたる部分に escapeshellarg を使用するか,$param をチェックするする必要がある.

	$cmd_to  = "cal " . escapeshellarg ( $param ) ;
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

弦と矢と半径 – 6

Python のコードを修正して「結果のみ」を出力する様に変更.

import	sys
import	math

def	r_cs	(c , s)	:	return	(        ( c*c )  / ( 8 *s ) +  s/2 )
def	s_rc	(r , c)	:	return	( r-math.sqrt(r*r - (c/2)*(c/2) )   )
def	c_rs	(r , s)	:	return	(   math.sqrt(r*r - (r-s)*(r-s) )*2 )

cmd =       sys.argv[1]
p1  = float(sys.argv[2])
p2  = float(sys.argv[3])

#print	(cmd + " " + str(p1) + " " + str(p2))

if  	cmd == "r_cs"	:	print	(r_cs(p1,p2))
elif	cmd == "s_rc"	:	print	(s_rc(p1,p2))
elif	cmd == "c_rs"	:	print	(c_rs(p1,p2))
#else	            	:	print	("error")

#print	("")

弦と矢と半径 スマートフォンからアクセス
PHP
あまり綺麗なコードでないので,ここには張り付けていません.リンク先を見てください.
PHP から Python の呼び出し
https://mish.myds.me/…/r_cs/6/

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

弦と矢と半径 – 5

PHP から Python の呼び出しで,Python のコマンドライン引数を使用する.

<?php

	echo	("call python\n") ;

	echo	("\n") ;
	system	("python r_cs.py r_cs 6 1") ;
	system	("python r_cs.py s_rc 5 6") ;
	system	("python r_cs.py c_rs 5 1") ;

	echo	("\n") ;
	system	("python r_cs.py r_cs 8 2") ;
	system	("python r_cs.py s_rc 5 8") ;
	system	("python r_cs.py c_rs 5 2") ;

	?>

Python のコードは,

import	sys
import	math

def	r_cs	(c , s)	:	return	(        ( c*c )  / ( 8 *s ) +  s/2 )
def	s_rc	(r , c)	:	return	( r-math.sqrt(r*r - (c/2)*(c/2) )   )
def	c_rs	(r , s)	:	return	(   math.sqrt(r*r - (r-s)*(r-s) )*2 )

cmd =       sys.argv[1]
p1  = float(sys.argv[2])
p2  = float(sys.argv[3])

print	(cmd + " " + str(p1) + " " + str(p2))

if  	cmd == "r_cs"	:	print	(r_cs(p1,p2))
elif	cmd == "s_rc"	:	print	(s_rc(p1,p2))
elif	cmd == "c_rs"	:	print	(c_rs(p1,p2))
else	            	:	print	("error")

print	("")

Python がよくわかっていないので,いろいろなエラーが…
PHP から Python の呼び出し コマンドライン引数
https://mish.myds.me/…/r_cs/5/

弦,矢,半径

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

弦と矢と半径 – 4

先日の Python コードのバグ(整数で計算されてしまうため結果が異なる).
原因はすぐわかるが,対応は悩む所.
コードを分解して動作を確認してみた.

def	r_cs_o	(c , s)	:	return	(        ( c*c )  / ( 8 *s )  +  s/2  )
def	r_cs_n	(c , s)	:	return	(        ( c*c )  / ( 8.*s )  +  s/2. )

print   (6*6)
print   (8*1)

print   (36/8)
print   (36/8.)

print   (1/2)
print   (1/2.)

print	("")
print   (36/8 +1/2 )
print   (36/8.+1/2.)

print	("")
print	(r_cs_o(6,1))
print	(r_cs_n(6,1))

Python での「浮動小数点数」の動作テスト
https://docs.python.org/ja/3/howto/pyporting.html?highlight=除算


Synology NAS DSM では Python 2.7 が標準で入っているみたい.
「パッケージ センター」で Python3 を追加できる.

C:\Program Files\Microsoft Office\Office14>cd C:\Users\Iwao\AppData\Local\Temp

C:\Users\Iwao\AppData\Local\Temp>ssh -l Iwao -p 2200 192.168.1.116
Iwao@192.168.1.116's password:
Iwao@DS116:~$ python3
Python 3.5.1 (default, Jan 29 2018, 14:16:30)
[GCC 4.9.3 20150311 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Iwao@DS116:~$ python2
Python 2.7.12 (default, May 12 2020, 04:48:57)
[GCC 4.9.3 20150311 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Iwao@DS116:~$ python
Python 2.7.12 (default, May 12 2020, 04:48:57)
[GCC 4.9.3 20150311 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Iwao@DS116:~$

Synology NAS DS116  python コマンド
ASUSTOR NAS ADM では入ってない.「App Central」でインストール可能.
ASUSTOR NAS Python


2020/11/20
QNAP NAS での Python3 は,他の NAS と異なるみたい.
opkg install python3 でインストールしなければならなかった.
https://mish.myds.me/wordpress/dev/2020/08/29/ts253d-setup-3-opkg/
https://mish.myds.me/wordpress/dev/2020/08/17/ts-253d-setup-7-python3/

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

弦と矢と半径 – 3

JavaScript は html に埋め込んだ.

<!DOCTYPE html>
<html	lang="ja">
	<head>
		<meta	charset="UTF-8"	/>
		<meta	name="viewport"   	content="width=device-width,initial-scale=1.0">
		<title	>JavaScript</title>
		</head>
	<body>
		<script>

			function	r_cs	(c , s)		{	return	(        ( c*c )  / ( 8*s )  +  s/2 ) ;		}
			function	s_rc	(r , c)		{	return	( r-Math.sqrt(r*r - (c/2)*(c/2) )   ) ;		}
			function	c_rs	(r , s)		{	return	(   Math.sqrt(r*r - (r-s)*(r-s) )*2 ) ;		}

			document.write	("6 1 5") ; 	document.write	("<br/>\r\n") ;
			document.write	(r_cs(6,1)) ;	document.write	("<br/>\r\n") ;
			document.write	(s_rc(5,6)) ;	document.write	("<br/>\r\n") ;
			document.write	(c_rs(5,1)) ;	document.write	("<br/>\r\n") ;
			document.write	("") ;      	document.write	("<br/>\r\n") ;

			document.write	("8 2 5") ; 	document.write	("<br/>\r\n") ;
			document.write	(r_cs(8,2)) ;	document.write	("<br/>\r\n") ;
			document.write	(s_rc(5,8)) ;	document.write	("<br/>\r\n") ;
			document.write	(c_rs(5,2)) ;	document.write	("<br/>\r\n") ;
			document.write	("") ;      	document.write	("<br/>\r\n") ;

			</script>
		</body>
	</html>

動作は,
https://mish.myds.me/…/r_cs/3/
html に JavaScript を埋め込み

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

弦と矢と半径 – 2

今度は PHP からの呼び出し.

<?php

	echo	("call c++\n") ;
	system	("./a.out") ;

	echo	("call python\n") ;
	system	("python r_cs.py") ;

	?>

実際の動作を試すには,gcc と python が必要です.
cpp のコンパイルは
g++ -Wall r_cs.cpp
これで ./a.out が作成されます.
python の呼び出しは
python r_cs.py
r_cs.cpp のコンパイルと r_cs.py の実行
次の所で,同じ様な結果を表示します.
https://mish.myds.me/…/r_cs/2/

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

弦と矢と半径

次の様な計算を何かに使えないかと…

/*
https://ja.wikipedia.org/wiki/矢_(幾何学)
https://en.wikipedia.org/wiki/Circle#Sagitta
弦 c と 矢 s から 半径 r を求める
r  =	(c*c) / (8*s) + s/2

半径 r と 弦 c から 矢 s を求める
s  =	r - sqrt( r*r - (c/2)*(c/2) )

半径 r と 矢 s から 弦 c を求める
c  =	sqrt( r*r - (r-s)*(r-s) ) * 2

i_func.hxx
https://drive.google.com/file/d/1kHadFbhUi9QfGRovMXKYr2xHgcFJAqdZ/view
*/

double	r_cs	(const double c , const double s)	{	return	(   ( c*c )  / ( 8*s )  +  s/2 ) ;	}
double	s_rc	(const double r , const double c)	{	return	( r-sqrt(r*r - (c/2)*(c/2) )   ) ;	}
double	c_rs	(const double r , const double s)	{	return	(   sqrt(r*r - (r-s)*(r-s) )*2 ) ;	}

弦 矢 半径
動作を確認するために 3,4,5 や 5,12,13 は知っていたが次のキーワードで検索.
三平方の定理 整数 組み合わせ
https://ja.wikipedia.org/wiki/ピタゴラスの定理


先ず C++ で書いたもの.

#include	<cmath>

double	r_cs	(const double c , const double s)	{	return	(   ( c*c )  / ( 8*s )  +  s/2 ) ;	}
double	s_rc	(const double r , const double c)	{	return	( r-sqrt(r*r - (c/2)*(c/2) )   ) ;	}
double	c_rs	(const double r , const double s)	{	return	(   sqrt(r*r - (r-s)*(r-s) )*2 ) ;	}

#include	<iostream>

int main(void){
	std::cout << "6 1 5"   << std::endl ;
	std::cout << r_cs(6,1) << std::endl ;
	std::cout << s_rc(5,6) << std::endl ;
	std::cout << c_rs(5,1) << std::endl ;
	std::cout << std::endl ;

	std::cout << "8 2 5"   << std::endl ;
	std::cout << r_cs(8,2) << std::endl ;
	std::cout << s_rc(5,8) << std::endl ;
	std::cout << c_rs(5,2) << std::endl ;
	std::cout << std::endl ;

	return  0 ;
	}

次の所に貼り付けて動作確認できます.
https://paiza.io/ja/
https://wandbox.org/
https://ideone.com/


次は JavaScript

function	r_cs	(c , s)		{	return	(        ( c*c )  / ( 8*s )  +  s/2 ) ;		}
function	s_rc	(r , c)		{	return	( r-Math.sqrt(r*r - (c/2)*(c/2) )   ) ;		}
function	c_rs	(r , s)		{	return	(   Math.sqrt(r*r - (r-s)*(r-s) )*2 ) ;		}


	console.log	("6 1 5") ;
	console.log	(r_cs(6,1)) ;
	console.log	(s_rc(5,6)) ;
	console.log	(c_rs(5,1)) ;
	console.log	("") ;

	console.log	("8 2 5") ;
	console.log	(r_cs(8,2)) ;
	console.log	(s_rc(5,8)) ;
	console.log	(c_rs(5,2)) ;
	console.log	("") ;

Python

import	math

def	r_cs	(c , s)	:	return	(        ( c*c )  / ( 8.*s ) + s/2. )
def	s_rc	(r , c)	:	return	( r-math.sqrt(r*r - (c/2)*(c/2) )   )
def	c_rs	(r , s)	:	return	(   math.sqrt(r*r - (r-s)*(r-s) )*2 )

print	("6 1 5")
print	(r_cs(6,1))
print	(s_rc(5,6))
print	(c_rs(5,1))
print	("")

print	("8 2 5")
print	(r_cs(8,2))
print	(s_rc(5,8))
print	(c_rs(5,2))
print	("")

2020/05/30
r_cs.py の r_cs で「浮動小数点数」として扱われていなかったので修正.
def r_cs (c , s) : return ( ( c*c ) / ( 8.*s ) + s/2. )

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

AS5202T 温度

最近気温が少し高くなってきたので,ちょっと気になる ASUSTOR NAS の温度.
HDD の温度が Synology NAS と比べると高い.
Synology NAS では 40℃前後.AS5202T は 50℃前後になっている.
AS5202T の温度
CPU温度は ASUSTOR NAS の場合は問題ないらしい.
UNISTAR のサポート情報  CPU温度が70度というのは正常ですか?
ここを読むと,ファン速度を「自動」にしている限りは HDD の温度の許容範囲ということか?
ファン速度は 770 RPM なので「低速」の状態.
手動で「中速」や「高速」にすると,それぞれ 2590 RPM と 4280 RPM .


今も使用している WD Cloud も 50℃前後.
以前 WD Cloud に大量のデータをコピーしていたら 55℃を超えた位からコピー速度が遅くなった.
この動作は WD Cloud によるのか WD Red によるものなのかは不明.
WD Red は PC でも使用しているが,こちらは十分冷却されているので遅くなったと感じたことはない.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

VirtualBox 6.1.8 に

前から VirtualBox の 6.1 があるのは知っていたが…
6.0.20 から上げてみた.


PC へのインストール手順はいつもと同じだが,前バージョンのアンインストールに時間がかかっていた.
6.1.8 に更新後「保存」状態だった仮想マシンを起動すると,


仮想マシン”Test10″のセッションを開けませんでした。
pci#0: Device vga/0 failed to respond to region #0 size/type changing from 0x0000000002000000/0x8 to 0x0000000002000000/0x0: VERR_SSM_LOAD_CONFIG_MISMATCH [ver=4 pass=final] (VERR_SSM_LOAD_CONFIG_MISMATCH).
終了コード : E_FAIL (0x80004005)
コンポーネント: ConsoleWrap
インターフェース: IConsole {872da645-4a9b-1727-bee2-5585105b9eed}
仮想マシン"Win10"のセッションを開けませんでした。


Win7 も同様.Linux の仮想マシンは問題なかった.
Windows の仮想マシンは「破棄」して「起動」させれば OK .


Win10 IP 環境の 2004 への更新は,相変わらず.
Win10 IP 環境の 2004 への更新 86%
86% で再起動した時に失敗してしまう.
Win10 IP 2004 インストールの修復を試みています...

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

AP がうまく動作しない?

作成した AP がうまく動作しなくなってしまった.
AP がうまく動作しない フリーズ?する
起動はするがメニューの「ファイル」の部分を選択したりするとフリーズ?する.
ハッキリわからないが「オーナードローメニュー」か?


PC を再起動することで動作する様にはなったが,原因などが絞れていないのでメモ.


2020/07/07 同じ現象が発生.
サインアウトして入り直しではダメで,PC の再起動の必要がある.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Win10 2004 インストール

Win10 Ver.2004 があったので VirtualBox 仮想マシンにインストールしてみた.
使用したのは ja_windows_10_business_editions_version_2004_x64_dvd_ee7b2698.iso .


最初,何も考えずにインストールしたら「Microsoft アカウント」と結びついたものになってしまった.
インストール途中で「ローカル アカウント」にする方法は気がつかなかった.


そのため,もう一度やり直し.ネットワークを切断した状態でインストール
今度はうまくいった.
Win10 2004 「ローカルアカウント」でインストール


2020/08/31
ローカルアカウントでインストールするための選択画面
ローカルアカウントでインストールするための選択画面
左下の「オフライン アカウント」を選択する.


2020/09/20
次の画面の場合は「代わりにドメインに参加する」を選択.
Win10 LTSC 2019 「ローカルアカウント」の入力に

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

VS 2019 16.6 への更新で失敗

VS 2019 のアップデートがあったので,いつもの様に更新したら何故か失敗.
インストール動作の半分位の所でエラーになってしまった.
実際はアンインストールしてインストールとなるので,アンインストール中かも?


もう一度「スタート」-「Visual Studio Installer」を起動して更新.
「スタート」-「Visual Studio Installer」
一通りのインストールは終わって「再起動」.
VS 2019 インストール   PC 再起動
更新できたみたい.


VirtualBox に入れた Win10 IP の 2004 への更新.
何度か再起動後の 86% の所でエラーとなった.
Win10 IP  2004 への更新で失敗

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

サイトがダウンしています

メールをチェックしていると,


サイトがダウンしています
Iwao Dev が読み込めませんでした (Jetpack 2020年5月20日 (水) 8:30 AM時点)
サイトのアクティビティログを確認すると、この問題の原因になっている可能性のある最近の変更に関する詳細がわかります。サイトに変更を加えていない場合はホスティングサービスに連絡し、追加のサポートを受けてください。
サイトが再びオンラインになったことをJetpackが検出したときに、こちらから別のメールを送信します。
サポートが必要ですか ? ご心配はいりません。
このメールは、サイトでダウンタイムモニタリングが有効にされているため、送信されました。サポートにご連絡いただく場合は、リファレンス番号 [136721373/intermittent] をお知らせください。
これらのアラートはセキュリティ設定でカスタマイズできます。
Automattic, Inc.
60 29th St. #343, San Francisco, CA 94110, USA
WordPress.com のメール設定を管理します。
サイトがダウンしています


DS116 のログを見みると,DSM のアップデートがかかった.
普段であれば更新後うまく動作すると思うが…
DDNS の更新通知がうまく機能していなかった?
「コントロール パネル」-「外部アクセス」-「DDNS」で「今すぐアップデートする」で更新.
これでうまくアクセスできるようになった.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

AS5202T VirtualBox

以前よりは良くなってきたと思うが,昨夜からまた調子が…


昨夜 ASUSTOR NAS の OS ADM のアップデートがあったので更新した.
ASUSTOR NAS ADM 3.5.0.R5D3
ADM 更新後 VirtualBox も問題なく起動してうまく動作していると思ったが…
仮想マシン DevX がネットワークから見えない.
リモートデスクトップでは開けるが,VNC ではつながらない.
DevX を再起動すると,途中で止まってしまうことも…


今回試したこと.
AppCentral の VirtualBox 5.2.22.r08 を一度 OFF にして ON に.
仮想マシンの設定は変更していない.


これでうまく起動したが,何度か再起動させると止まってしまった.
AS5202T VirtualBox
もう一度 AppCentral で OFF にして ON に.
これで起動したのでそのままに.


2020/09/21
6.1.12 に更新.安定している.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

AS5202T 再セットアップ – 9

Linux Center を入れて Debian 10 Desktop をインストール.
AS5202T Linux Center
次のページを参考にさせてもらって日本語化.
https://www.server-world.info/query?os=Debian_10&p=japanese
WSLのDebian環境を日本語化する
sudo apt -y install task-japanese locales-all
sudo apt -y install task-japanese-desktop
再起動させて日本語になった.
AS5202T Debian 10 Desktop 日本語化


2020/05/05
gcc のインストール.
sudo apt install build-essential
glut のインストール.
sudo apt install freeglut3 freeglut3-dev
他によく使う tree のインストール.
sudo apt install tree
AS5202T Debian glut
https://dev.mish.work/wordpress/2019/08/16/glut-install/
https://jml.mish.work/index.php/cpp/install-glut.html
https://jml.mish.work/index.php/cpp/glut.html


2020/05/06
Debian の環境の実体は以下に存在している.
/volume1/.@plugins/AppCentral/linux-center/containers/debian10/rootfs/home/admin
AS5202T Linux Center  Debian10 rootfs

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Windows の資格情報マネージャー

久しぶりに Win7 環境から NAS に接続して ??? と思ったのでちょっと調べてみた.


以前 Win7 から NAS に接続する時,いつも面倒と思っていたこと.
Windows で特定の宛先に対して使用する資格情報を資格情報マネージャーに記憶しているにもかかわらず、再度、資格情報の入力を要求される
Win7 は「Iwao」でログインすると入れるが,PC の再起動後などにまた要求される.
Win7 ログオン情報入力
次の様にユーザ名を「…\Iwao」と入力する必要がある.
Win7 ログオン情報入力
Win7 資格情報


Win10 ではちょっと違うみたいだが,はっきりした記述は見つけられなかった.
Win10 資格情報

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

PHP から iconv コマンド呼び出し

シフトJIS のデータファイルをアップロードして WebGL で表示のテスト.
PHP から作成した .out を呼び出しているが,その中で文字コードの変換がうまく機能していない.
.out の中では iconv ライブラリを呼び出す.うまく機能しない時は iconv または uconv コマンド.
.out をコンソールから実行した時はうまく機能している.


いろいろと動作を調べていると,次の様なコマンドが PHP から呼出された時うまく機能していない様子.
iconv -f CP932 shiftjis.txt > out_file.txt
コンソールでは OK .
ここまで絞り込むのに 1 日かかった


今回の修正前 Synology NAS では次の様にしていた.
uconv -f sjis -t utf8 shiftjis.txt -o out_file.txt


先日テストしていた時 ASUSTOR NAS ではエラーになったので,単純に -t オプションを取ってしまった.

Iwao@AS5202T:/volume1/Web/Test/mics/tc_xconv $ iconv -f CP932 -t utf8 shiftjis.txt
iconv: conversion to utf8 unsupported
iconv: try 'iconv -l' to get the list of supported encodings
Iwao@AS5202T:/volume1/Web/Test/mics/tc_xconv $

iconv -l を幾つかの環境で調べていると “utf8” の指定がうまくない.
いろいろな環境でうまく機能しそうなのは “UTF-8” .
Fedora iconv -l | grep -i utf
Raspberry Pi iconv -l | grep -i utf
DS116 uconv -l | grep -i utf
AS5202T iconv -l | grep -i utf


-t オプションを指定しないとうまくないみたいで,次の様に変更.
iconv -f CP932 -t UTF-8 shiftjis.txt > out_file.txt
これで意図した動作になった.


2020/09/08 変換できない文字が存在した時に止まらない様な指定を追加.
https://mish.myds.me/wordpress/dev/2020/09/07/upload-mbcs-name/
exec_ic.hxx
text_gnc.hxx

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.