Zhang Wenwei (張文蔚) (died April 25, 908), courtesy name Youhua (右華), was an official of the Chinese Tang Dynasty and Tang's succeeding Later Liang dynasty, serving as a chancellor during the reigns of Tang's final emperor Emperor Ai and Later Liang's founding emperor Emperor Taizu (Zhu Quanzhong). During Tang Dynasty Background It is not known when Zhang Wenwei was born. His family claimed ancestry from the early Han Dynasty general Zhang Er (張耳). The traceable ancestry of Zhang Wenwei's included officials of Sui Dynasty and Tang Dynasty. His grandfather Zhang Junqing (張君卿) was a copyeditor at Jixian Pavilion (集賢院), and his father Zhang Shang (張裼) served in a number of prominent positions, including, eventually, the military governorship (Jiedushi) of Tianping Circuit (天平, headquartered in modern Tai'an, Shandong). Zhang Wenwei had at least two younger brothers, Zhang Jimei (張濟美) and Zhang Yixian (張貽憲), both of whom, like he, would eventually pass the imperial examinations in the Jinshi (進士) class. However, only Zhang Yixian would go on to serve as an imperial official; Zhang Jimei would be stricken by mental ailments, and it was said that Zhang Wenwei, while eventually progressing in his career, would care for Zhang Jimei's health for over 30 years, drawing praise from the gentry of the day. Zhang Wenwei himself was said to be good at writing in his youth, and he was both studious and friendly with people, gaining the reputation of being a gentleman. Early career Zhang Wenwei passed the imperial examinations in the Jinshi class in 875, during the reign of Emperor Xizong. He thereafter served as a surveyor for the office of salt and iron monopolies; he then served as a sheriff of a county near the imperial capital Chang'an, as well as a scholar at an imperial institute. After his father Zhang Shang died in 877, he left governmental service to observe a mourning period and to attend to the household. Sometime during Emperor Xizong's Zhonghe era (881-885), when Emperor Xizong had fled to Chengdu due to the major agrarian rebellion led by Huang Chao, who captured Chang'an and declared his own state of Qi as its emperor, Emperor Xizong, in order to raise funds for the military campaigns against Qi, moved the office of salt and iron monopolies to Yang Prefecture (揚州, in modern Yangzhou, Jiangsu) and put the official Li Du (李都) in charge of the office. At Li Du's