When the Emperor Xiaowu of Liu Song was building a shrine to the memory of his favourite concubine, the Prince's mother, Zhang would only subscribe a hundred cash.
On the road, he fell into the hands of bandits; but when they were about to cut his head off, they found him quietly reciting a poem, at which they were so astonished that they let him go.
He managed to reach Huế after a long passage, during which he composed a famous poem, called Song of the Sea (海賦), admitted by Xu Kaizhi (徐凱之) to be superior to his own work under the same title.
On his return, he was raised to high office, and was subsequently a great favourite with the Emperor Gao of Southern Qi, who said that he could not do without one such man, nor with two.
In spite of his exalted rank he dressed so poorly that on one occasion his Majesty sent him an old suit of clothes, with a message that a tailor had been instructed to take his measure for a new one.