You mean you're trying to put a string into an HTML tag attribute that contains a double quote?
The correct way to deal with that is to html-encode the string. Obviously that means that the code using that data attribute must know that and html-decode if before use.