It wasn’t as if Bei Zhenying didn’t know that her husband was unusual, or even that he had some secrets.

He was a talented computer programmer, and she fell for his inquisitive intelligence and playfulness when they met at university in Shanghai. But he was also proudly nonconformist — refusing to use social media or buy new clothes — and intensely private, disappearing into his study to do work he wouldn’t discuss.

Bei, 45, accepted those quirks as the habits of a professional geek, someone engrossed in a world that she, a corporate business manager, didn’t understand. But she never imagined just how little she knew about her husband, Ruan Xiaohuan, until the Shanghai police stormed into the couple’s apartment and took him away.