May
19
0
Uesugi Kenshin by Eiji Yoshikawa

Proof of Life

This New Year, Kenshin turned 33. Still a young age. Yet, his attire was very plain. His long-sleeved haori was made of unadorned yamamayugara silk in an uguisu-tea color, and his hakama appeared to be made from a special type of fabric. He always wore a hood and, amidst the splendidly dressed retainers celebrating the New Year, he quietly observed them with a smile. He looked like a young monk from the Rinzai sect mingling among them.

“How adorable they are, don’t you think? That’s why I find them so endearing,” Kenshin said to the person next to him.

Uesugi Norimasa, the Kanto Kanrei, nodded and said, “Indeed,” then turned to the distinguished guest on his right and added with a smile, “The people of Echigo are known for their bravery and perseverance, but I never knew they had so many innocent and multi-talented individuals.”

This distinguished guest was the only court noble from the capital, referred to as Lord Kumano, but in reality, he was Konoe Sakitsugu, the heir of the Kanpaku family. This year, amidst the chaos of Eiroku 4, even though it was New Year’s, this court noble sat calmly among the rough warriors, sharing drinks and enjoying the festivities. He was different from the typical courtiers who only appreciated the beauty of nature. It could also be imagined that he held great ambitions regarding these warriors.

This is the interior of Umyabashi Castle in Joshu. From the perspective of Kyoto, it was still considered a wild and rustic part of the Kanto Plain. For a noble of that time to travel to such a place required considerable determination and purpose.

Early spring has dawned. A joyful new year has begun. It is truly wonderful to welcome the new year in this way. We’ve come a long way.

Countries are rising and fighting. The clouds of last night have disappeared, and the morning sun is blazing. It feels as if the age of the gods has come to life again.

Now, warriors, because we are alive, everyone is unique. This is the unparalleled joy of life. Let’s live with the determination to even eat grass roots.

On January 7th, there was the traditional sake banquet. The young samurai of the Echigo army sang long songs in the style of imayo, mixing in their regional accents. Eventually, they all stood up together, clapping their hands in rhythm, filling the main hall of the castle’s first tower, forming a circle as they danced around, fully enjoying the life of today.

The Shadow of Shingen

“It seems to have become customary to greet the New Year on the battlefield every year now. Last year, we were in the camp in Etchu, but where will we be next year, I wonder?”
Kenshin mused as he asked for a cup from the person next to him. Kensuke Uesugi, looking apologetic, replied,
“As the Kanto region’s guardian, I am powerless amidst the troubles on all sides, and I feel deeply indebted to have to ask for your far-off assistance.”
Kenshin, sensing his concerns, comforted him,
“I did not say that to hear such words from you. Please, don’t take it the wrong way.”

His long-time rival, Shingen of Kai, had established a truce three years ago in Eiroku 1, agreeing to “live as good neighbors” and forming a pact of friendship. On the surface, it seemed that Kenshin had nothing to worry about from Shingen, but in reality, his enemy’s hostility had merely gone underground, making it even more troublesome for Kenshin.

Shingen’s political prowess, despite being confined to his small province, extended deeply into the internal affairs of other countries. Particularly in terms of diplomatic strategy and intelligence, the young Kenshin was no match for the seasoned, battle-hardened monk-warrior Shingen. Last year, Kenshin’s campaign in Etchu to crush the troublesome Jinbo clan who invaded the borders revealed many with Shinshu accents among the captured troops, and monks and soldiers influenced by Shingen. Numerous secret documents were also discovered, making it clear that this too was part of Shingen’s strategy.

However, dealing with this shadow was tricky. Sweep away one threat, and another would appear elsewhere. People often said, “Shingen has seven body doubles, making it impossible to know who the real Shingen is,” referring to his deceptive strategies and elusive presence.

After subduing the disturbances on the borders and returning to his Kasugayama Castle, Kenshin had barely removed his armor when another urgent request for assistance came from the Uesugi clan at the Uesugi Kanryo in Umayabashi, Joshu, calling him to Kanto. The enemy was Hojo Ujiyasu of Odawara. The Hojo forces were threatening the smaller neighboring territories like Satomi and Satake, and without intervention, the unrest would spread throughout Joshu, jeopardizing the Uesugi clan’s position.

Kenshin immediately departed from Kasugayama and headed south to Joshu in August last year. Using Umayabashi Castle as his base, he rallied the small countries of Boso and launched his grand plan to attack Odawara. They welcomed the new year of Eiroku 4 in the castle, four months into the campaign with the outcome still uncertain. Maintaining morale in such a prolonged campaign was essential. Thus, sometimes, as today, it was meaningful to drink, sing, and relax. Kenshin looked on, satisfied. The guest, Konoe Sakimune, also seemed to enjoy himself. Only Kensuke Uesugi appeared worried, thinking,
“Is this really alright?”
and unable to fully enjoy the festivities.

However, the banquet did not become unruly. Everyone knew their limits. Those who had been dancing and singing the most enthusiastically were the first to say,
“That’s enough.”
“Let’s call it a night.”
They put down their cups and signaled the serving staff to bring food, and everyone started eating seriously from large bowls.

At that moment, four or five men, noses reddened from the cold, returned from outside. They bowed to the master and guests from a distance, then one group broke through the crowd and quickly grabbed chopsticks and bowls. Kenshin spotted them from afar and called out,
“Is that Shimotsuke?”
Startled, Saito Shimotsuke straightened up and replied,
“We have just returned.”
“You cannot eat immediately. It seems you haven’t had a drink yet. Come here,” Kenshin beckoned with his cup.

Dec
26
0
PHPのhtmlspecialchars

`htmlspecialchars`は、PHPで文字列をHTMLエンティティに変換するための関数です。この関数は、HTML特殊文字をエンティティに変換することで、クロスサイトスクリプティング(XSS)攻撃などからウェブアプリケーションを保護するのに役立ちます。

基本的な使用法は以下の通りです:

$original_string = '<p>This is a <b>bold</b> statement.</p>';
$escaped_string = htmlspecialchars($original_string);

echo $escaped_string;

上記の例では、`$original_string`に含まれるHTML特殊文字(`<`, `>`, `&`, `”`, `’` など)がエンティティに変換され、`$escaped_string`に格納されます。これにより、特殊文字がそのままHTMLとして解釈されず、表示されます。

`htmlspecialchars`は、デフォルトではダブルクォート (`”`)、シングルクォート (`’`)、アンパーサンド (`&`)、小なり記号 (`<`)、大なり記号 (`>`) をエンティティに変換します。もしシングルクォートもエンティティに変換したい場合は、第二引数に `ENT_QUOTES` を指定します。

$original_string = "This is John's book.";
$escaped_string = htmlspecialchars($original_string, ENT_QUOTES);

echo $escaped_string;

このようにすることで、シングルクォートもエンティティに変換されます。

注意: `htmlspecialchars`を使用すると、HTML特殊文字がエンティティに変換されますが、他の文字エンコーディングに関する考慮が必要です。場合によっては、第三引数で文字エンコーディングを指定することが望ましいです。例えばUTF-8を使用する場合:

$escaped_string_utf8 = htmlspecialchars($original_string, ENT_QUOTES, 'UTF-8');
Dec
26
0
PHPのhtmlspecialchars_decode

`htmlspecialchars_decode`は、PHPでエスケープされたHTMLエンティティを元の文字列に戻すための関数です。`htmlspecialchars`や`htmlentities`などでエスケープされた文字列を元に戻す際に利用されます。

基本的な使用法は以下の通りです:

$escaped_html = "<p>This is a <b>bold</b> statement.</p>";
$original_html = htmlspecialchars_decode($escaped_html);

echo $original_html;

この場合、`$original_html`にはエスケープされていない元のHTMLが含まれます。この関数は、HTMLエンティティを対応する特殊文字にデコードします。

`htmlspecialchars_decode`は、デフォルトで `ENT_COMPAT` フラグを使用します。これはダブルクォートのみをエンティティとしてエスケープする設定です。もしシングルクォートもエスケープしたい場合は、`ENT_QUOTES` フラグを指定します。

$escaped_html = "<p>This is a <b>bold</b> statement with 'single quotes'.</p>";
$original_html = htmlspecialchars_decode($escaped_html, ENT_QUOTES);

echo $original_html;

このようにすることで、シングルクォートも正しくデコードされます。

注意: `htmlspecialchars_decode`は、HTMLエンティティに対してのみ機能します。`htmlentities`でエンティティ化された文字列に対しては、`html_entity_decode`を使用する必要があります。

Dec
26
0
PHPのhtmlentities

`htmlentities`は、PHPで文字列をHTMLエンティティに変換するための関数です。これを使用すると、HTML文書内で特殊文字(たとえば、 `<`, `>`, `&`, `”`, `’` など)をエスケープして表示することができます。これにより、クロスサイトスクリプティング(XSS)攻撃などからウェブアプリケーションを守ることができます。

基本的な使用法は以下の通りです:

$html = "<p>This is a <b>bold</b> statement.</p>";
$escaped_html = htmlentities($html);

echo $escaped_html;

この場合、`$escaped_html`にはエスケープされたHTMLが含まれます。これを出力すると、HTMLタグがそのまま表示されずにエスケープされた形で表示されます。

`htmlentities`関数は、デフォルトでISO-8859-1文字セットを使用しますが、文字セットを指定することも可能です。例えばUTF-8を使用する場合:

$escaped_html_utf8 = htmlentities($html, ENT_QUOTES, 'UTF-8');

`ENT_QUOTES`は、シングルクォートもエスケープするためのフラグです。

注意: `htmlentities`を使用すると、すべての特殊文字がエンティティに変換されます。これにはタグも含まれます。HTMLを再度表示する場合、`html_entity_decode`を使用して元の文字列に戻すことができます。

$original_html = html_entity_decode($escaped_html);

これにより、エンティティが元の特殊文字に変換された文字列が取得できます。

Dec
24
0
PHPのhtml_entity_decode

`html_entity_decode` 関数は、HTMLエンティティを通常の文字に変換するためのPHPの組み込み関数です。HTMLエンティティは、特殊文字や予約文字を表現するための特殊な表記法です。例えば、`<` は `<` を表し、`>` は `>` を表します。

以下は `html_entity_decode` 関数の基本的な使用例です。

<?php
// HTMLエンティティを含む文字列
$html_entity_string = "<p>Hello, &world&!</p>";

// html_entity_decode 関数を使用してHTMLエンティティを通常の文字に変換
$decoded_string = html_entity_decode($html_entity_string);

// 変換された文字列を表示
echo $decoded_string;
?>

この例では、`<p>Hello, &world&!</p>` というHTMLエンティティを含む文字列を `html_entity_decode` 関数で変換しています。結果として得られる文字列は `

Hello, &world!

` となります。

`html_entity_decode` 関数は、通常はHTMLエンティティを通常の文字に戻すために使用されます。また、第二引数を指定することで、変換するエンコーディングを指定することもできます。

$decoded_string = html_entity_decode($html_entity_string, ENT_QUOTES, 'UTF-8');

上記の例では、変換するエンコーディングとして UTF-8 を指定しています。